Warning/Notice about functions.php

‘;)’ => ‘icon_wink.gif’, is in line 2477 in the current version, you should never just change or delete core files, unless you know how to run a private branch of WordPress. Line 2925 is the second trigger_error() in this function: function _deprecated_argument( $function, $version, $message = null ) { do_action( ‘deprecated_argument_run’, $function, $message, $version ); … Read more

How to replace bloginfo(template_url)

bloginfo($option) echos out a value whereas get_template_directory_uri() returns a string – did you maybe forget to echo get_template_directory_uri()? Also are you passing a string with quotes i.e. bloginfo(template_url) vs bloginfo(‘template_url’)? Both bloginfo(‘template_url’) and get_template_directory_uri() should work, they aren’t deprecated.

How can I see a list of pages and post where my custom Gutenberg block is used?

General block name search One can e.g. use the general search in the /wp-admin backend to find some text within the post’s content that stores the blocks: We can search for a prefixed block name wp:my-plugin/my-block within the posts: example.com/wp-admin/edit.php ?s=wp:my-plugin%2Fmy-block%20&post_type=post where we have an extra space (url encoded as %20and / as %2F) after … Read more

Automating deprecated call checks?

I was inspired by your question to create a plugin that I’ve been kicking the can on for several months. I’m calling it Deprecation Checker. By default, it scans the plugin and theme directories (recursively) to find deprecated functions. The functions list is sourced directly from the WP deprecated files. It then outputs a nice … Read more

What is the best way to handle deprecated functions?

I don’t see anything wrong with your approach. But I’m going to take a different track: don’t support older versions of WP. The general impression I’ve gotten from the WP community is one of progress. By supporting the current version and forward you’re helping to push the community towards using the most up to date … Read more

Deprecating functions in a plugin class

Non existing Callbacks One of the nice things is, that neither do_action(), nor apply_filters() do trigger an error if a callback isn’t present. This means that its the safest way to insert plugin data into templates: If a plugin is turned off and do_action()/apply_filters() don’t find the callback in the global $wp_filters array, nothing happens. … Read more

How to deprecate a function used in a plugin?

In addition to the answer by @Welcher: There are some good “graveyard” examples in the core, where “functions come to die“. You could use them as guidelines, e.g. regarding the documentation. Here’s one such example for the permalink_link() under the wp-includes/deprecated.php /** * Print the permalink of the current post in the loop. * * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)