wp_dequeue_script for a Plugin

It still displays the script because you are using the wrong hook (and it doesn’t exist) — wp_dequeue_scripts, and secondly, if the script is indeed enqueued via wp_enqueue_script(), then the generated id (used in the <script> tag) is in the form of <script handle>-js (i.e. suffixed with a -js) where <script handle> is the first … Read more

register_setting & add_settings_error validation issues with multiple fields

If you want your sanitization callback to apply only to a specific settings field (i.e. a database option registered using register_setting()), then you would want to use a different callback for each of your settings fields. E.g. // Sample field HTML: //<input name=”field-1″ value=”<?php esc_attr( get_option( ‘field-1’ ) ); ?>”> function my_settings_field_1_validation( $value ) { … Read more

Where are the src and srcset sizes coming from?

Themes and plugins can use the add_image_size function to define image sizes. Whenever an image is uploaded, WordPress will generate a separate image file for every size that is defined. Now, when you insert an image in your post, WordPress will ask you which size you want to use by default. This will be the … Read more

Ajax filter button display all posts

Going by what @JacobPeattie said, that they are still set but empty you need to change the conditional login to check for empty. In our previous discussion I wrote this conditions if ((isset($_POST[‘categoryfilter1’]) && !empty($_POST[‘categoryfilter1’])) && (isset($_POST[‘categoryfilter2’]) && !empty($_POST[‘categoryfilter2’]))) { // both properties are set and have value (not empty) } elseif ((isset($_POST[‘categoryfilter1’]) && !empty($_POST[‘categoryfilter1’])) … Read more

Add meta tags to a custom header

HTTP headers are different than the HTML head. The meta tag you’re looking to add (for the Twitter card) is actually a meta tag that gets place in the HTML head. So to achieve exactly what you’re looking to do from a PHP “functions” file, you’d want to hook into wp_head instead. Like this: add_action(‘wp_head’, … Read more

Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection

After tons of digging it appears that the way the error message is worded was a bit misleading. Refused to load https://www.service-domain.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy. What isn’t clarified above is that it wasn’t the server/site I was working on that Refused to load from … Read more

Divi change project category slug

add_filter( ‘register_taxonomy_args’, ‘change_taxonomies_slug’, 10, 2 ); function change_taxonomies_slug( $args, $taxonomy ) { if ( ‘project_category’ === $taxonomy ) { $args[‘rewrite’][‘slug’] = ‘stainless-steel-products’; } return $args; }