get_mostpopular()

The get_mostpopular() has been deprecated since 2.0.3

Today i updated the WordPress Most Popular Posts plugin i use for displaying the posts with the most views in the sidebar widget that comes with the WP-Clear theme from Solostream. Right after updating and deleting the cache i noticed an error message showing up where the most popular posts were supposed to be displayed. Instead of the most popular posts the widget in the sidebar displayed something about get_mostpopular() being deprecated.  The full error message was

Warning: The get_mostpopular() has been deprecated since 2.0.3. Please use wpp_get_mostpopular() instead.

Since it wasn’t there before i figured it had to do with the update of the WordPress Most Popular Posts plugin, so i had a quick look at the files and found a function that checks for the use of get_mostpopular() and, if found, displays the above warning. The quick and dirty fix for removing that warning / error message is to comment out the line of code that is responsible for displaying that warning / error message. Open the file /wp-content/plugins/wordpress-popular-posts/wordpress-popular-posts.php in a text editor and scroll all the way down to the end of the file. The last lines of code should be

For the quick and dirty fix simply change it to

See how the trigger_error has been commented out? This will stop the message from displaying. As i said, this is a quick and dirty fix. In my
particular case the problem was not caused by the actual WordPress Most Popular Posts plugin, but by the WP-Clear theme i use for the blog. It hasn’t really been updated and still uses a lot of old functions/code. So i checked the theme-widgets.php file of the WP-Clear theme and discovered the actual cause for the error /warning message to appear. When looking at the theme-widgets.php file you will find this bit of code there

The lines containing the get_mostpopular function are causing the error message in the first place. So changing that from get_mostpopular to wpp_get_mostpopular will solve this issue and the error / warning message will no longer be displayed

 Please remember

Commenting out the warning is nothing but a quick fix. If possible you should, instead of just making the error message invisible, investigate which of your plugins or themes is still using get_mostpopular and update the code accordingly

1 Comment

Leave a Reply

Your email address will not be published.


I confirm

*