Recently I was upgrading various WordPress plugins one of which was the WP Block Admin plugin. This plugin will redirect all users with certain permissions away from the default /wp-admin directory back to the homepage after login. This is beneficial if most of your users only have to login for a forum or for comments on WP posts. After upgrading the plugin I noticed it was no longer working. I went through the below steps to resolve the problem.
First off the configuration file for this plugin is very simple thus making it an easy problem to resolve. The plugin is located in the /wp-content/plugins/ sub directory in a folder called wp-block-admin and besides a readme file there is only one PHP file located in this directory called wp-block-admin.php. Besides the commenting (including version number) at the top of the file the only other difference in the file was on line 33.
The upgraded, version 1.2, WP Block Admin had the following code on line 33:
- if (strpos(strtolower($_SERVER['REQUEST_URI']),'/wp-admin/')) {
The old version, version 1.0, of WP Block Admin had the following code on its line 33:
- if (strstr(strtolower($_SERVER['REQUEST_URI']),'/wp-admin/')) {
To resolve the issue I simply changed strpos to strstr in the new file and things started working properly. I lack the PHP knowledge to know specifically what the issue is but after some research it appears that strstr was modified to strpos because it is faster. More information on strstr versus strpos here. So if this article helps resolve your WP Block Admin upgrade issue and you are more knowledgeable in PHP than I am please post information about the details of why this resolves the problem in the comments below. Thanks!
I have big fun read this blog post. I need to see more on this content.. Thank you for posting this great content.. Anyhow, I’m likely to subscribe for a rss and I want you write good posts once again rapidly.
Hello Brian,
Thanks for complimenting our articles. We will do our best to continue posting answers to technical questions that may assist others resolve their technical issues.
Thanks.
alex