Modify a Filters Second Parameter

No this isn’t possible without changing the original code. Filters work on the very first parameter, the other parameters are provided for context. You will need too either get the author to add a filter for the data variable, fork the plugin, or use a competitor. The only exception, is if $data is an object … Read more

Need resource on available functions and objects

Hi @menardmam: Let’s try with what I wrote in the question : $cat->cat_name. How can I know that cat_name is a method that return something from $cat from get_the_category() function? Frankly the best way to know an answer like that is to use a debugging IDE and to trace through the WordPress core source code. … Read more

List of Body Classes Generated by body_class()

Several classes have been added since WordPress 2.8 (when the WPEngineer post was written). I would refer directly to the body_class() Codex entry, which currently lists the following: rtl home blog archive date search paged attachment error404 single postid-(id) page-id-(page_id) attachmentid-(id) attachment-(mime-type) author author-(user_nicename) category category-(slug) tag tag-(slug) page-parent page-child parent-pageid-(id) page-template page-template-(template file name) … Read more

Changing the visible url path to css & js files

Offhand I think you’d need two things: First, a rewrite rule in your .htaccess file like so: RewriteEngine On RewriteBase / RewriteRule ^css/(.*) /wp-content/themes/theme-name/css/$1 [L] RewriteRule ^js/(.*) /wp-content/themes/theme-name/js/$1 [L] Second, add a filter to your theme’s functions.php like so: function change_css_js_url($content) { $current_path=”/wp-content/themes/theme-name/”; $new_path=”https://wordpress.stackexchange.com/”; // No need to add /css or /js here since you’re … Read more

Why, Where, and When to use reference pointers in filters/hooks?

The example you give is used when you’re building a plugin/theme using a class. In normal use, your functions.php file would just have: function my_function_to_filter( $args ) { // … function stuff here return $args; } add_filter(‘some_wp_filter’, ‘my_function_to_filter’); If you’re using a class, though, things would look different. You’d likely have a my-class.php file containing: … Read more

Is there a list / reference for all current native WordPress blocks?

Not at the moment, but, you can go to a page with the block editor, open the browser dev tools, go to the console, and run the following: // grab all block types const types = wp.blocks.getBlockTypes(); // filter to just the core blocks const core_blocks = types.filter( type => type.name.startsWith( ‘core/’ ) ); // … Read more