How to check if we are in the init hook?

You can use did_action to test for this, e.g.: if ( did_action( ‘init’ ) < 1 ) { // init has not ran yet! Throw the exception } https://developer.wordpress.org/reference/functions/did_action/ did_action returns the number of times that action has been run. This can also be used to ensure it only happens once for filters that happen … Read more

Add custom CSS for plugin admin Page

I guess you’re using this code in a wrong file other than the main plugin file (usually /wp-content/plugins/wp-cricket-info/wp-cricket-info.php). So, the file you’re referencing when enqueueing is actually incorrect. Follow the steps below- Define a constant in the main plugin file that references the file itself. define( ‘WP_CRICKET_INFO’, __FILE__ ); When enqueueing the CSS, use that … Read more

Get form fields data on form submission using forminator plugin

While I can’t comment on Forminator on this stack, there is a basic mistake involving add_action causing the error message in your log. The cause of this is that your function requires 2 arguments to work, but you did not tell add_action this, so it used the default 1: add_action( string $hook_name, callable $callback, int … Read more

Create dynamic wordpress blank page

Try something like this: in the load hook, you can ouput your xml code. u function my_menu_pages() { $hook = add_submenu_page( null, ‘Page Title’, ‘Page Title’, ‘administrator’, ‘sub-menu-slug’, function() { } ); add_action(‘load-‘ . $hook, function() { // add your xml code here, // you will get a blank page to start with exit; }); … Read more

Using Query Loop Block to list all posts under each category

Use WP_Query directly in your WP theme template files instead of a block editor. // Define custom taxonomy (category) terms $categories = get_terms(array( ‘taxonomy’ => ‘your_custom_taxonomy’, // Change ‘your_custom_taxonomy’ to the name of your taxonomy ‘hide_empty’ => false, )); // Loop through each category foreach ($categories as $category) { echo ‘<h2>’ . $category->name . ‘</h2>’; … Read more

Displaying the Virtural robots.txt file

The current/computed directives that WP generates for a virtual robots.txt file are not available with any function call or filter. The directives are only available with a page request similar to https://www.example.com?robots=1 . That page request will result in WP generating and returning the contents of the virtual robots.txt file, along with a Header. The … Read more

Verify Cryptographic Authenticity after Downloading Releases (Signatures)

If you downloaded the latest version then your download URL would have been: https://wordpress.org/wordpress-6.5.3.zip You can find the md5 hash for this file by adding .md5 to the end of that URL, like this: https://wordpress.org/wordpress-6.5.3.zip.md5 The md5 hash for this file is: ad3b0a21dec368341d64906e86db49f7 So, theoretically, you should be able to get the md5 hash of … Read more

Disable image compression for WebP

It does cover webp as well. From several google pages the default compression was 86. You could also test to confirm by uploading a few with different settings in your functions. This issue on Github shows they changed the default quality to 82. https://github.com/WordPress/performance/issues/563. We can see that webp images use the same quality value … Read more