YouTube embeds Cross-Origin Request Blocked (CORB) error

I have found out that i have enabled tracking protection in that particular Firefox profile. A relevant warning, which i oversaw by just displaying the errors, was also displayed. The resource at “https://googleads.g.doubleclick.net/pagead/id” was blocked because content blocking is enabled. Apparently https://googleads.g.doubleclick.net/pagead/id. does honor the tracking protection setting. Today i learned to use a clean … Read more

counting slugs not working?

Now I’m however getting: Fatal error: Uncaught Error: Undefined constant “cat” That’s because the cat and post_tag were not wrapped in quotes (e.g. ‘cat’), and they also did not start with the dollar sign ($) as in $cat, which indicates a variable, hence PHP tried to find the constants named cat or post_tag, and when … Read more

Creating an array with gettexed terms

To adapt the second part of your code to work with the first part, where you are using wp_dropdown_categories to generate the dropdown list, you can use the get_terms function to retrieve all terms of the tipologia taxonomy and then iterate over them to create your $names_trans array. In the wp_dropdown_categories call, you pass the … Read more

Count post with tags within one category?

Yes it is possible to count the posts with certain tags within a particular category. You can achieve this by using a combination of wp functions like WP_Query to retrieve posts and get_terms to retrieve the tags within the specified category. <?php $category_slug = ‘donotallowpost’; $term_slugs = [ ‘cat’, ‘bird’, ‘chinchilla’, ‘dog’, ‘ferret’, ‘hamster’, ‘horse’, … Read more

Advanced Custom Fields – How do I get field values of a group within a group field type

I should not have been looping at all. This (not optimized) code fixes all issues and adds Difficulty. add_shortcode(‘get_run’, ‘get_run_status’); function get_run_status($atts) { $atts = shortcode_atts(array( ‘run’ => ”, ), $atts); $run_output=””; $diff_output=””; $found_day = false; $found_night = false; $run_atts = sanitize_text_field($atts[‘run’]); $run_query = get_field($run_atts); if($run_query): $run_status = $run_query[‘status’]; $run_difficulty = $run_query[‘difficulty’]; endif; foreach ($run_status … Read more

Filtering according to the locale ‘de_DE’

To achieve filtering according to the locale de_DE for the taxonomy terms displayed in the search box selector, you can use a similar approach as your archive title filter. add_filter(‘wp_dropdown_categories’, function( $output, $args ) { $locale = get_locale(); if (‘de_DE’ == $locale && $args[‘taxonomy’] == ‘tipologia’) { // Modify output for German locale and ‘tipologia’ … Read more

Show a text in menu

You used the correct filter, but the reason it isn’t showing has nothing to do with menus, and everything to do with the basics of how filters work. That filter gives a string and expects a string in return, so if we add type hints the problem becomes much more obvious: function add_search( string $items, … Read more

Uncaught Error: Undefined constant “WP_CONTENT_DIR”

Yes, this is a bug, but it appear only when the WP configuration is not finished. The error occurs on this line (in wp-includes/load.php) : if ( ! extension_loaded( ‘mysql’ ) && ! extension_loaded( ‘mysqli’ ) && ! extension_loaded( ‘mysqlnd’ ) && ! file_exists( WP_CONTENT_DIR . ‘/db.php’ ) ) { (…) This checks that mysql … Read more

Adding a css class to the gallery

If you look at the gallery shortcode you will see that you are using the wrong filter. With post_gallery you can override the complete html of the shortcode. Your code performs a str_replace on an empty string, resulting in an empty return and subsequently the generation of the default gallery html. Further on there is … Read more