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

Calling a function via a shortcode in javascript

I’m afraid the code you’ve shared is rather wonky and there isn’t just one thing that is backwards. Here are the first few things that came into my mind. add_filter( ‘learn-press/after-content-item-summary/lp_lesson’, ‘psb_comment_listener_func’); When you attach a callback function to a filter with add_filter, the callback should return a value. If the callback isn’t supposed to … Read more

How to automatically flush permalinks?

To automatically flush permalinks every hour, use the following code: Hook the scheduling function to init. Schedule an hourly event if not already scheduled. Hook the scheduled event to a function. Define the function to flush rewrite rules. // Hook the scheduling function add_action( ‘init’, ‘schedule_my_hourly_event’ ); // Schedule the event function schedule_my_hourly_event() { if … Read more

Is there a way to pull remotely generated XML, process it, and display it on a Managed WordPress page?

Step-by-Step Guide to Create a WordPress Plugin for Fetching and Displaying Remote XML Data 1. Create a New Plugin Directory Connect to your WordPress installation via FTP or use the file manager in your hosting control panel. Navigate to wp-content/plugins/. Create a new directory named remote-xml-fetch. 2. Create the Plugin File Inside the remote-xml-fetch directory, … Read more

Does it make sense to sanitize the output of an SVG file?

It’s not completely pointless, but probably smart to sanitize, because of the following situations: What’s the certainty that the SVGs only come from you directly? Can you guarantee that the SVGs won’t be intercepted during upload? Redundancies for keeping your site secure are generally recommended. I don’t know that wp_kses() is the best for sanitizing … Read more

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