How to Turn Off WordPress Comments for Good

For some of the websites you create, comments are completely unnecessary. Sometimes it’s a matter of not wanting people to comment on your pages.

Posts are fine, but why does WordPress even think that pages would need comments? Then there’s the fact that some comments present a security risk if they contain suspicious links that visitors unknowingly click on.

So, let’s keep this short and sweet. You want to get rid of comment functionality on your WordPress site? Here’s how to do it.

8 Ways to Disable Comments in WordPress

There are different reasons why you’d want to disable comments in WordPress and not every reason is going to lead you to the same solution. So, whether you want to disable comments for certain posts, disable comments on all pages, create tighter controls over who can comment, or just get rid of that pesky comment spam, there is a fix for you:

Method #1. Individual Page Controls

There may come a time when you want to block (or allow) comments on a specific page or post of your website. I’d say this is a pretty rare use case, but it’s still good to know that you have the option to control comments within each page.

Step 1

Navigate to the Page or Post in WordPress that you want to update this setting for.

Step 2

Scroll down to the bottom of the page until you see a box labeled Discussion. If you do not see that box, scroll back up to the top of the page and drop open the Screen Options in the top-right corner. Click Discussion and then scroll down again. It should be there now.

Step 3

To disable comments on this page, unclick the Allow comments box. You can also disable trackbacks and pingbacks here as well. (More on that in option #5 below.)

Discussion box in the Dashboard

Step 4

Save your changes.

If you want to disable comments for all pages on your site, scroll down to option #7.

Method #2. Disable All Future Post Comments

Now, if you decide that you want to shut off comments on your posts, you can set a universal control from the Settings within WordPress.

Step 1

In WordPress, go down to the Settings tab and select Discussion.

Step 2

At the top of this page, you’ll see a section called Default article settings. Uncheck Allow people to post comments on new articles if you want to disable this functionality.

Default article settings

As is noted beneath that checkbox, you can override that setting by changing the settings on individual posts. Just follow option #1’s steps above.

Step 3

Save your changes.

Take note that this setting only applies to new posts that you create on your WordPress site. You’ll need to enable #3 if you want to disable comments on older posts.

Method #3. Set Auto-Close on Comment Sections

Let’s say you’ve taken care of #2, but you want to remove comments from previous posts. You can do this through the same discussion settings in WordPress.

Step 1

In WordPress, go down to the Settings tab and select Discussion.

Step 2

In the Other comments settings section, check the Automatically close comments on articles older than [0] days. This will effectively remove the comment form and thread on all posts previously created.

Other comment settings

Step 3

Save your changes.

Method #4. Implement Stricter Comment Controls

If the issue you have is that you like some of the comments coming through but want better control over which ones actually publish to your site, you can set up those restrictions within WordPress’s settings as well.

Step 1

In WordPress, go down to the Settings tab and select Discussion.

Step 2

The amount of control you put over how comments are submitted, reviewed, and approved is up to you.

Comment settings

This page will allow you to do a number of things like:

  • Only allow registered users to submit a comment.
  • Receive an email whenever a comment comes through.
  • Require manual approval of all comments.
  • Give frequent commenters a free pass to comment without approval.
  • Put comments into a queue if they contain suspicious links.
  • Blacklist comments that contain certain words, links, etc.

Step 3

Save your changes.

Method #5. Kick out Trackbacks and Pingbacks

Trackbacks and pingbacks are comments that appear on your posts after someone has linked to your content on their own website. Since many of these are just spam, many WordPress users choose to disable them entirely.

Step 1

In WordPress, go down to the Settings tab and select Discussion.

Step 2

Under default article settings, uncheck Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.

Trackbacks

You can also disable this on individual pages or posts by following option #1.

Step 3

Save your changes.

Method #6. Use the Akismet Plugin

The Akismet plugin is one of the most popular and well-reviewed WordPress plugins available, and for good reason. It sifts through all the comments that come into your site, instantly detecting whether or not they look like spam. The best thing about this plugin is that it’s pretty hands-off. You shouldn’t need to go into your Comments folder to clean out bad or other suspicious-looking comments. Akismet will put them aside for you.

Method #7. Use the Disable Comments Plugin

This is the WordPress plugin you’ll need if you want to completely disable comment functionality. This means that there will be no comments on pages or posts on your site. The Disable Comments also disables comments fields and sections throughout the WordPress admin so that users can’t override the universal settings. So, if you need a one-and-done comment disabler, this is it.

Method #8. Use the Disable Comments RB Plugin

Disable Comments RB plugin

No special skills or code modifications needed to disable comments on your website using Disable Comments RB. Just install the plugin and enable main functionality.

You can set comment controls for pages all at once without affecting your posts.

Key features of Disable Comments RB:

  • All comments links in admin menu are hidden
  • Hide Dashboard / Recent Comments section
  • Hide Dashboard / Discussion section
  • All comment links in admin bar are hidden
  • Disable all comments widgets
  • Discussion page settings turned off
  • Disabled RSS/Atom feeds
  • Turn off Pingback functionality in header
  • Pingbacks are disabled

A smart algorithm makes this plugin simple and powerful. While it allows global disabling of comments on all posts, pages, and attachments, it also permits selective enabling of comments anywhere on your website. Just edit this functionality in the desired sections of your WordPress site.

Wrapping Up

Well, there you have it: eight simple ways to enable, disable, and get a better handle on comments on your WordPress site. It might seem like overkill, but every WordPress site has different needs when it comes to comments and thus different solutions are required.

Editor’s Note: This post has been updated for accuracy and relevancy.
[Originally Published: 2013 / Revised: 2017, 2022]

How To Add Google Analytics To WordPress Without a Plugin

When you think about the greatest pairings of all time, you probably think about duos like Batman and Robin, Mickey and Minnie, and peanut butter and jelly. Then again, there is the very modern duo of WordPress and Google Analytics.

While they might not make the layman’s list of greatest partners, I bet they’d be pretty high up there for WordPress design, development, and marketing professionals.

If you have a WordPress website, then you should have Google Analytics (GA), too — no questions asked. It’s not like the two can’t exist without one another (as in any healthy relationship), but I’d argue that the universe just doesn’t seem right when the two aren’t paired up. The question is: how do you make this love connection happen?

Pairing Google Analytics’ Tracking Code and WordPress

You’re most likely aware of at least one of three options available to help you connect Google Analytics to your WordPress site:

  1. Add Google Analytics with a plugin;
  2. Create a Google Analytics WordPress plugin; or
  3. Add Google Analytics to WordPress without a plugin.

That last one? We’re show you in this post where to find your Google Analytics code and how to add Google Analytics to WordPress without a plugin.

Note: we don’t recommend adding Google’s tracking code without a plugin. 

Wait, What?

That’s right. We’ll show you how and where to add the code for analytics tracking, but we honestly believe either of the other two options will serve you and your website better.

Why?

  1. Adding Google Analytics to WordPress with a plugin is easier, faster, and hassle-free;
  2. If you code GA into WP yourself,  you’ll have to add the Google Analytics code again when you switch themes; and
  3. A Google Analytics plugin sets up all features automatically, saving you time.

Now, we get it. If you want hands-on control of how GA tracks your data, then you’ve got to add the Google Analytics tracking code manually. Or, if you’re learning the basics of how WordPress works, then this is an easy task to start with.

Whatever your reasons (and do let us know yours the comments! we’d love to know), let’s jump in.

How to Add Google Analytics to WordPress Without a Plugin

You’re just six simple steps away from adding the tracking code manually.

Let’s count them down.

Step #1: Create a Google Account

Create a Google Account So You Can Add GA Tracking Code Manually To Your Website
Create a Google Account

Create a Google account if you haven’t already, and set up a property — aka your website.

Step #2: Log in to Google Analytics

Sign in to Google Analytics
Sign in to Google Analytics
With your Google account created, you can now sign into Google Analytics. Select your email address and log in.
With your Google account created, you can now sign into Google Analytics. Select your email address and log in.

Step #3: Get Your Google Analytics Tracking ID

Once you have logged into Google Analytics, go to the Admin area at the bottom-left corner of your Google Analytics dashboard.

The Admin area of the Google Analytics Dashboard
The Admin area of the Google Analytics Dashboard

You’ll see three columns of admin settings controls. In the middle column, click on Tracking Info and then select the Tracking Code option.

WhereTo Find the Tracking Info for Google Analytics
WhereTo Find the Tracking Info for Google Analytics

Step #4: Copy Your Tracking Code

The Tracking Code tab will open and show your property’s unique tracking ID, along with the full Google Analytics tracking code.

An Example of Google Analytics Tracking Code
An Example of Google Analytics Tracking Code

Once you get your GA tracking code, you will need to copy it in full.

Step #5: Log in to WordPress and Add the Code

Note: You should always create a child theme for your WordPress site before editing theme files (as you will in this next step). Check out our post about How to Create a WordPress Child Theme if you need a recap.

So, where in the HTML of your webpage should you place your analytics tracking code?

Log in the backend of your WordPress website.

Once logged in, go to the Appearance > Editor tab in the sidebar. On this screen, you’ll see all of your site’s files displayed to the right, and each file’s Google Analytics code snippet displayed in the middle of the page.

Go to Appearance > Editor
Go to Appearance > Editor

Unless you’re only planning to track visitor activity on certain pages of your website (unlikely), you’ll want to insert the code somewhere that will automatically apply the tracking site-wide.

Where can you do that?

Look for the header.php file along the right-hand side. Click on it to open; the code editor will appear in the middle of your screen.

Look for the closing tag within the code. A simple Ctrl + F will help you quickly locate it.

Use your browser’s search function to look for the closing Head tag.
Use your browser’s search function to look for the closing head tag

Once you find it, insert your cursor just before the tag and paste in your Google Analytics tracking code. Then click on the Update File button below the code editor to save your changes.

Step #6: Test Your Connection To GA While Waiting

After adding Google Analytics to WordPress, it takes anywhere from 24 to 48 hours for new data to populate.

So while you won’t start seeing the data on any traffic to your site immediately, you can test the connection you’ve established.

Check by returning to the Tracking Code page in Google Analytics. To the right of your Tracking ID is a Status Update. To confirm everything’s working properly, click on Send Test Traffic. This will open your site in a small window.

If all is well, your account should update to show an active user count of 1. Yay!

If the active user count doesn’t appear immediately, be patient. Google says this can take up to a minute.

Need More Help With Your Google Analytics Tracking Code?

If you missed our comprehensive guide to Google Analytics, take some time to read through it once everything is set up and ready to go on your WordPress site. It’ll give you a great introduction into what Google Analytics is, what it does, and what you can learn from the insights found within it.

And if you want to get even more granular with your tracking, check out our Tracking File Downloads With Google Analytics and WordPress.

Are you looking for an easy way to deliver your Google Analytics data to your WordPress clients? Check out how you can create pdf reports of GA dashboard data.

Ready? Set? Get Tracking!

You’ve come a long way since the start of this article – from not knowing how or where to put your Google Analytics tracking code, to getting your first test user counted and seeing your Analytics in action.

Congrats!

Now, it’s time to put what you’ve learned to work, and get that code on your WordPress site.

If you need any help (and you’re a WPMU DEV member), contact our Support experts 24/7 with questions. Or, if you’re still figuring out whether a membership is right for you, post in the comments below. We’re happy to help you measure the metrics of your WordPress site with Google Analytics, in whatever way we can.

To your success!

Best Project Management Software Tools for Your WordPress Business (2022)

Are you looking for project management tools for your WordPress development business? After surveying thousands of our users, we put together some of the best project management software for your organization.

Good project management tools are essential for WordPress developers. They can help you organize, prioritize, and implement new projects. Plus, they’ll keep effective communication between you, your clients, and your team. It’s a win-win.

This article explores some of the best project management software in the business! Also, we’ll go over how to make a decision on what type of software you need.

You’ll see that some of these tools are efficient for design, while others focus on communication. Additionally, some everyday tasks and projects work well for larger teams — and some smaller ones. And you’ll notice there are free options and paid ones.

We’ll be covering:

We’ve gathered research from thousands of members and found some interesting insights on what developers use in their organizations. We present our results below.

All of this being said, every one of the above platforms has a solid reputation and is at the top of our list of most recommended project management software. (No, we are not affiliated with any of them.)

So, which one(s) should you choose?

Factors When Choosing Project Manager Tools

Before we start looking into a few WordPress project management tools, let’s first discuss crucial factors you need to consider when choosing software that is suitable for you, both as a web developer and for a digital agency.

#1. Deployment Location: Self-Hosted vs. Cloud

It’s the modern era of cloud services, SaaS services, or whatever name you want to call them; services available fully online are now the norm.

The reason why these services have taken off and become so popular are various. Still, here are two that are the strongest differentiators:

  • Always on – SaaS-based products are available from anywhere and at any time. Today’s modern office is not restricted by location, time, geography, or anything else. If you’ve got an internet connection, you can work – physical access to your office is a thing of the past. SaaS fully enables the digital nomad lifestyle.
  • Lower Total Cost of Ownership – You can start immediately with cloud-based software. No need for infrastructural investments, licensing costs, maintenance agreements, or support personnel. The initial investment and the running costs are typically cheaper for cloud-based products, even when paying monthly and per user, especially for SMBs.

#2. Focused or Adapted for Web Design and/or WordPress Project Management

This article discusses project management tools with a specific focus on WordPress and web design and development here, so the tool you should use must somewhat revolve around your needs as a web designer/developer.

While nonspecific project management tools are a dime-a-dozen, you’ll find more suitable candidates when you start niching into web design and WordPress.

Now, don’t get me wrong, generic tools are great. Many are open and configurable enough to let you get on with the job – even if they are not specifically developed with WordPress or web design project management. In fact, we’ll cover quite a few tools that are quite general.

#3. The Service Addresses Your Pain Points

Before you subscribe to one of the many project management services, you’ll need to do a little bit of introspection:

  • What are the problems I’m facing as a web designer or agency?
  • What changes do I need to make in my own processes besides adopting a project management tool?
  • Do I need to resolve internal communication issues?
  • Do I have a problem managing or communicating with the client?
  • Do I typically underestimate the effort required and overspend on budgeted hours?
  • Do I have problems remembering all the tasks that need to be done?
  • Are my developers and designers having trouble getting through to each other?

As you can see from the above, some of the problems can be resolved using a good project management tool; others can be resolved if you use proper job scheduling software, while others still need surgery.

No software can fix intrinsic problems YOU have to fix.

Luckily, a good WordPress project management tool can surely ease some of the nagging pain points most agencies and freelancers are bound to experience during their day-to-day business. In fact, I daresay a project management tool is essential if you care about the success of your business.

So, let’s get to it!

Project Management Software

Google Workspace

Google Workspace banner.
A well-known name that has your workspace covered.

Google Workspace, formally G Suite, is “a flexible, innovative solution for people and organizations to achieve more.” They offer a vast variety of tools to collaborate with coworkers and clients.

Tools include custom email, Calendar, Meet, Chat, Drive, Docs, and more.

Google Workspace example.
Google Meet is an example of what’s included in Google Workspace.

Google Workplace has various plans and pricing that are based on cloud storage, users, and specific pages (e.g. appointment booking pages available on all but one plan).

Nimbus

 

nimbus platform header.
Nimbus has a lot of various elements to make this a go-to project management tool.

Nimbus is a platform with a variety of tools – including Nimbus Note (for creating online notes, docs, and wikis), Nimbus Capture (for screenshots and screencasts), and Nimbus Clipper (for grabbing web pages and deleting irrelevant parts).

It consists of client portals, easy collaboration, knowledge sharing, and project management tools.

Nimbus example.
Collaboration is simple and easy with Nimbus.

Over a million professionals use their software. A great perk of their platform is it’s free to get started. Then, you can upgrade for an insanely cheap price. The upgrades include more workspaces, automation, custom SMTP, and more.

Slack

Slack header
Slack is another household name for remote teams.

Here at WPMU DEV, Slack is no stranger to us. After all, we use it to communicate with our coworkers daily. We have Huddle calls, provide feedback on plugins (and other tech), determine what blog posts to write about (like this one!) – and much more.

It’s one platform for the entire team and work. Everything can be managed from Channels, Slack Connect (to sync up with teams at other companies), Messaging, and more.

Slack example.
Slack works well on mobile and desktop platforms.

Considering it’s essential to our workflow here at WPMU DEV, and we’ve been happy with it, it’s worth checking out as a reliable option for your own project management.

Slack has pricing options that depend on the size of your business or organization.

Zoom

Zoom banner
Zoom is a great way to communicate.

“For staff communication, we use Zoom for meetings and email for regular correspondence.”

Tisagh C. – WPMU DEV Member

Another very popular software for project management is Zoom. Zoom is one of those platforms that’s known as THE video conferencing platform. “Hey, let’s have a Zoom call.” Ever heard that or something similar?

Their virtual meeting capabilities allow you to “meet” with anyone globally. Whether it be mobile or your computer – it’s possible to communicate with coworkers, potential clients, or anyone in a few clicks.

You can record the conversations, have up to 1000 participants, enable chat, and much more.

Zoom example.
A Zoom meeting is a common way to get in touch with anyone.

Plus, sign up for Zoom for free. Or, you can upgrade if you need longer meetings, need more cloud storage, or depending on the number of participants in your meeting (e.g. 1000s of people).

Trello

Trello header.
Trello is an extremely popular project management software.

“I use Trello for project management and to organize my worklists.”

Marianna – WPMU DEV User

With Trello, you have the ability to see your projects at every angle – whether with a board, timeline table, workspace view – you name it. Trello is a leader when it comes to project management software.

It’s known as a visual platform where you can view all projects in one place in a simple and easy-to-understand way.

You can upload files, create checklists, add 3rd party apps, and much more.

Trello example.
Trello is used by over 2 million users worldwide.

Trello is free, or you can upgrade based on the amount of users, controls, and security you’d like.

Figma

Figma header.
Figma is great for brainstorming with clients or collaborators.

Especially great for designers, Figma works well in visually collaborative environments. It functions as if you’re in the same room – with sticky notes, online whiteboard for drawing or marking, and live collaboration.

You can map the process with their FigJam option. This keeps everything flowing and “jamming” as you collaborate, to ensure a project is done on time.

It’s easy to use and communicate with your team via text, notes, and handoffs from designer to developer.

A figma example.
A brainstorming session in Figma.

Figma is free, or you can upgrade if you need more Figma Files and resources.

Whatsapp

Whatsapp header.
Got a lot of messaging with a team to do? WhatsApp can help.

For mobile project management, WhatsApp is a free app designed for small business owners. With the app, you can use automated tools to connect with clients and quickly get back to clients’ messages.

WhatsApp has a group chat feature, so you can easily connect with your team. Beyond an app, you can sync your chats to your computer. Additionally, you can send PDFs, docs, spreadsheets, slideshows, and more.

Whatsapp example.
Though it’s known as an app, you can also use WhatsApp on your computer.

It’s entirely free to use WhatsApp, making it a simple solution to avoid SMS fees and communicate efficiently with your team and clients.

Notion

Notion header.
Notion is a highly customizable project management tool.

“I’m in it all day, every day. I even built a client dashboard template and want to create more for others.”

Keith – WPMU DEV Member

Notion is a highly customizable workspace where you can connect your teams, projects, and docs. You can drag and drop the dashboard, website, doc, or system however you’d like.

It’s used for project management by some top companies; such as Loom, Figma, mixpanel, and Pixar.

The goal of Notion is to simplify communication between you and your team by offering their streamlined customizable options all in one place.

Some examples of notion.
Customize the dashboard however you like.

It’s free to start with Notion, and then there are upgrades you can purchase monthly or yearly. Some packages include unlimited file uploads, collaborative workspaces, and admin tools.

Asana

asana header
Asana was made to make complex work simple.

“I used Asana for a long time, I like their UX, colors, and branding. As well as their explaining videos.”

Mo – WPMU DEV Project Manager

Want to eliminate frequent meetings and streamline your project management? Asana might be a great platform for you. You can manage dependent, overlapping, and unscheduled projects. Plus, it has boards that simplifies focus for you and your team.

Additionally, you can automate tasks, such as assigning work, setting due dates, and more. And there is reporting for your work, so you can easily monitor the progress.

Asana example.
You can label and organize your tasks by clients, coworkers, priorities, and more.

Asana is free. However, upgrades available have features, such as unlimited free guests, unlimited integrations, and more.

MS Teams

Microsoft header
Love Microsoft? MS Teams might be for you.

Of course, Microsoft is a giant in the tech world, and its MS Teams is a rising star in its universe. With MS Teams, you can create and manage teams, schedule meetings, use language transitions, share files, and much more.

There are even remote learning tools for educating your clients or developers.

Microsoft teams example.
For video conferencing, MS Teams is a great free solution.

It’s free to use, or you can upgrade if you have many users, need video transcripts, and more.

Jira

Jira header
Jira is a great way to schedule tasks from.

Like Slack, Jira is another go-to software here at WPMU DEV. Other developers agree that it’s great for project management. You can assign tasks, update them on a customized timeline, mark them as “done” and much more.

Plus, you can incorporate 3rd party apps (e.g. Slack) so that everything is organized in one convenient place. Here at WPMU DEV, we have it so that when a new task is assigned to an individual, they’re pinged on Slack. The link on Slack takes that person directly to the task.

Jira example.
Jira’s drag-and-drop dashboard makes it easy to organize and assign tasks.

Like a lot of our options, you can get Jira for free. Then you can upgrade depending on the amount of users you’ll need.

Basecamp

Basecamp header.
Basecamp prides itself on being simple.

With Basecamp you can manage people and projects in a simple and easy-to-use interface. Considering over 75K organizations use their platform, they’re definitely worthy of our list.

Basecamp features a one-page dashboard for your projects, assignments, and schedules. Plus, there’s a centralized place for discussions, a work tracker, file upload capabilities, instant chatting – and much more!

Basecamp examples.
Scheduling, communication, and tasks – all in one place.

You can try Basecamp for free and then upgrade – depending on how many users you have.

The Perfect Project Management Software Awaits

As you can see, there are many options when choosing project management software. Maybe just one of these platforms will do the trick — or maybe a combination of several. Either way, make your developer’s life easier with organized management tools.

Whether you opt for the free version or need to upgrade — try out some of these recommendations today!

Editor’s Note: This post has been updated for accuracy and relevancy. [Originally Published: May 2017 / Revised: October 2022]

Four Elements of Truly Mobile-Friendly Responsive Menus

There are hundreds of ways to create responsive navigation, limited only by your creativity and the boundaries of what CSS can accomplish. Good responsive navigation is a little harder – a responsive menu must become a mobile menu, adhering to the needs and rules of touch-driven devices. Mobile design is rapidly changing, and so the […]


The post Four Elements of Truly Mobile-Friendly Responsive Menus appeared first on Web Designer Wall.

Level Up Your CSS Skills With These 20 Pro CSS Tips

Front-end development is quickly becoming more and more focused on efficiency – faster loading and rendering through selector choice and minimizing code. Pre-processors like Less and SCSS go a long way in doing some of the work for us, but there are plenty of ways to write minimal, quick CSS the native way. This guide […]


The post Level Up Your CSS Skills With These 20 Pro CSS Tips appeared first on Web Designer Wall.

Easy CSS Animation With Transition & Transforms

Recently, I walked you through how to create a simple landing page that used a couple different CSS animation techniques. “Animation” is a loose term, in web design usually referring to anything that involves movement. CSS transitions are one tool we are given to manipulate elements on state changes or mouse events, and when combines […]


The post Easy CSS Animation With Transition & Transforms appeared first on Web Designer Wall.

Master CSS Flexbox in 5 Simple Steps

CSS flexbox is an incredibly useful tool for layout without using floats or positioning. Currently almost all current browser version support flexbox, making it a go-to standard for web design. It can solve a number of problems efficiently, such as vertical alignment, space distribution, ordering of elements and sizing. It offers more freedom to arrange […]


The post Master CSS Flexbox in 5 Simple Steps appeared first on Web Designer Wall.

How to Create Spotify Colorizer Effects With CSS Blend Modes

When Spotify launched their colorful new brand identity, featuring hip duo-toned imagery, it went hand-in-hand with a new Colorizer tool that allows artists to apply a variety of filters to images. This solved a problem in which Spotify needed a way to present the thousands of images uploaded, all with a different look and feel, […]


The post How to Create Spotify Colorizer Effects With CSS Blend Modes appeared first on Web Designer Wall.

Tutorial: Duo Layout With CSS3 Animations & Transitions (Pt. 2)

Last week I demonstrated how to build a split-screen website layout using CSS flexbox and viewport units that offers an alternative way to present a brand’s featured content. Clicking on one side or the other navigates further into the site without a page load, using CSS transitions and 3d transforms. This week, I’ll show you […]


The post Tutorial: Duo Layout With CSS3 Animations & Transitions (Pt. 2) appeared first on Web Designer Wall.

Tutorial: Trendy Splitscreen Layout With CSS3 Animations (Pt. 1)

There is no better time than the end of the year for some fresh inspiration! One of the most popular trends this year, features splitscreen layouts, lots of white space, clean typography and subtle effects. With this playful trend in mind, I’ve created a two-part tutorial to show you how to use flexbox, 3D transforms […]


The post Tutorial: Trendy Splitscreen Layout With CSS3 Animations (Pt. 1) appeared first on Web Designer Wall.

CSS Vertical Centering – Everything You Need To Know

Getting content to center perfectly within an element and then ensuring it responds properly at different screen sizes is one of the biggest challenges that still face front-end designers. It is not that it is difficult, but because there are several ways to go about it, figuring out which method is best can be confusing. […]


The post CSS Vertical Centering – Everything You Need To Know appeared first on Web Designer Wall.

You Might Be Tempted to Use These CSS Tricks But Should You?

The temptation to dive right into new and exciting CSS tricks is strong – you might even do it without knowing it through learning by example or implementing that hot new framework everyone is talking about. It is more important to fully understand new CSS classes and properties, experiment with them and learn their limitations […]


The post You Might Be Tempted to Use These CSS Tricks But Should You? appeared first on Web Designer Wall.

The Power of CSS Selectors and How to Use Them

One of the challenges of coding premium WordPress themes is the unpredictable nature of how they will be used. Compared to coding a custom website, especially one using static HTML documents where you have complete control over the markup, you have to solve problems creatively and ensure flexibility. In these cases, CSS selectors make all […]


The post The Power of CSS Selectors and How to Use Them appeared first on Web Designer Wall.

9 Simple CSS Image Filters

CSS image filters are a quick way to tweak images in the browser without resorting to Photoshop. This simple reference gives you 9 CSS filter shorthands that provide an excellent way to maintain style consistency across visual content on your site, or just add a little fun to image hovers. CSS filters are most commonly […]


The post 9 Simple CSS Image Filters appeared first on Web Designer Wall.

Create your own bulk actions

2016-10-21_13-46-04
Including version 4.6 it was quite difficult to add custom bulk actions to the WordPress admin pages. In version 4.7 a hook is added that simplifies the task a lot:

add_action('bulk_actions-{screen_id}', 'my_bulk_action');

Defining the hook

As an example we’ll use the post page, the variables are named accordingly.

add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions' );

Definig the hook

function register_my_bulk_actions($bulk_actions) {
  $bulk_actions['my_bulk_action'] = __( 'My Bulk Action', 'domain');
  $bulk_actions['my_other_bulk_action'] = __( 'My Other Bulk Action', 'domain');
  return $bulk_actions;
}

You can define more than one bulk action in this function because it merely adds an additional element to the array $bulk_actions. You simply have to take care that you use different names for the element keys and, logically, for the display texts.

The screen ids

The screen id of an admin page can be displayed this code snippet:

$screen = get_current_screen();
var_dump($screen);

This table shows the ids for some admin pages:

Page $screen_id File
Media Library upload upload.php
Comments edit-comments edit-comments.php
Tags edit-post_tag edit-tags.php
Plugins plugins plugins.php
Links link-manager link-manager.php
Users users users.php
Posts edit-post edit.php
Pages edit-page edit.php
Edit Site: Themes site-themes-network network/site-themes.php
Themes themes-network network/themes
Users users-network network/users
Edit Site: Users site-users-network network/site-users
Sites sites-network network/sites

Defining the callback function

Here’s an overview of the whole function:

add_filter( 'handle_bulk_actions-edit-post', 'my_bulk_action_handler', 10, 3 );

function my_bulk_action_handler( $redirect_to, $action_name, $post_ids ) { 
  if ( 'my_bulk_action' === $action_name ) { 
    foreach ( $post_ids as $post_id ) { 
      $post = get_post($post_id); 
      // process $post wp_update_post($post); 
    } 
    $redirect_to = add_query_arg( 'bulk_posts_processed', count( $post_ids ), $redirect_to ); 
    return $redirect_to; 
  } 

  elseif ( 'my_other_bulk_action' === $action_name ) { 
    foreach ( $post_ids as $post_id ) { 
      $post_meta = get_post_meta( $post_id ); 
      // process $post_meta update_post_meta( $post_meta ); 
    } 
    $redirect_to = add_query_arg( 'other_bulk_posts_precessed', count( $post_ids ), $redirect_to );
    return $redirect_to; 
  } 
  
  else 
    return $redirect_to; } 

As mentioned above you can define more than one custom bulk action but only a single callback function. So you first have to test which bulk action has been selected (lines 4 and 13).

Next the posts are processed in a foreach loop (lines 5 and 14). In this loop you can load the post with get_post or the post meta with get_post_meta() and process the data. Next the changed data is written back to the database with wp_update_post() or update_post_meta().

The variable $redirect_to (lines 9 and 18) is used to define the URL the browser will change to after the bulk actions have been completed, in our case it is set to .../wp-admin/edit.php?paged=1. We do not want to change the location but to use the variable to pass a value to the page the browser is redirected to.
With the function add_query_arg() we add an argument to the URL that specifies the number of processed posts: /wp-admin/edit.php?paged=1&bulk_posts_processed=1.

Display a success notification

After completing processing all posts you can display an admin notice using the action admin_notices(). The second parameter of the function call needs to contain the text string we have defined in our filter bulk_actions-{screen-id}:

function my_bulk_action_admin_notice() { 
  if ( ! empty( $_REQUEST['bulk_posts_processed'] ) ) { 
    $posts_count = intval( $_REQUEST['bulk_posts_processed'] ); printf( '
' . _n( 'Processed %s post.', 'Processed %s posts.', $posts_count, 'domain' ) . ' ', $posts_count ); 
  } 
} 

Trivia

A little fun fact at the end: The corresponding ticket (#16031) was opened six years ago, 2010, in that times we used WordPress v3.0.