Building a website with WordPress eventually leads to installing numerous WordPress plugins. Although bloggers are advised not to use a lot of plugins in their websites due to reduced loading page speed, there are a couple of must-have WordPress plugins that not only make the blog more attractive, but also improve the blog’s user experience, like related posts, sharing buttons or comments. One of the problems bloggers often deal with is about the loading order of the WordPress plugins, specifically in the end of their posts. How can WordPress users change the order of those plugins?
The answer lies inside the WordPress plugins’ code. The line that is responsible for the loading order of the plugins at the end of the posts should be similar to the following:
[box type=”info”] add_filter( ‘the_content’, ‘filter_function_name’, XX )[/box]
Note that XX represents a number according to which the specific plugin is loaded. As an example I will use the plugins I am using for this blog. At the end of each post I am including a bar of social buttons, a related posts plugin, a subscription plugin, an author plugin and the Disqus commenting system. Most often than not the comment section in a WordPress theme is well defined and the commenting system finds its appropriate placement without any change in the code. What happens though when at the end of your last paragraph your plugins load in an undesirable order?
When I first installed the aforementioned plugins, I got the author box first, social buttons, related posts and finally the subscription sign-up. Obviously I wanted social buttons to load first, since readers would find it convenient to share a useful article immediately after they finished reading it. In addition, the plugin that should load at the bottom end of the posts’ content would be the author box, given the blog is my personal one, thus readers would already expect me to write most of the posts! No need to force readers reading my bio repeatedly and possibly driving them away from the blog.
Changing the WordPress plugins’ loading order in posts
- Decide on the exact order of the plugins. Duh!
- Go to the plugins’ editor inside the WordPress blog’s admin dashboard.
- Edit the php file of the plugin you want to load first – in my example the social media buttons’ plugin.
- Search and find (ctrl+f usually) the code above – search for “filter” and scan through the results until you find a line similar to the code. Pay attention to the term “content”, because you’ll find some instances referring to the “excerpt”.
- Add or change the XX value to 10. Save the file.
- Edit the php file of the plugin you want to load second.
- Follow the same steps and add/replace XX value with 200. Click save.
- Continue the process for each plugin, using a higher number each time for the XX value. The plugin that will load last should have the highest XX value.
Experiment with the values until you get the desired result of the loading order. I am in no way a WordPress expert and definitely not an expert in PHP code. Yet, I have encountered this specific problem in almost all of my blogs and given I found this solution recently on my own, I thought to share it with other WordPress bloggers. There is also a WordPress plugin by Reveloper.com that claims to load WordPress plugins the way you need them. However due to developer’s lack of time, users report the plugin does not work since the latest WordPress updates.
If bloggers use WordPress to build their website, sooner or later they will face this kind of issue. I guess if they aren’t afraid of some minimum coding, changing the loading order of WordPress plugins should not take more than 5 minutes. And now readers can share the post right at the end of the posts’ last sentence! Neat huh?