I accidentally rejected my wordpress admin account!

Didn’t get the context Rejected, I’m suggesting this solution with keeping in my mind that you do not know the email and password of the account you rejected, you can recover your account from CPanel, go to your currently active theme’s functions.php file and use this function to create new admin; //add a new admin … Read more

Search page doesn’t recognise post_type=page

I found a solution in this answer here: https://stackoverflow.com/questions/63678063/wordpress-search-filtering-pages-and-posts I customised the function as follows: function page_search_filter( \WP_Query $query ) { if ( ! is_admin() ) { if ( $query->is_main_query() && $query->is_search() ) { if ( isset( $_GET[‘post_type’] ) && $_GET[‘post_type’] == ‘page’ ) { $query->set( ‘post_type’,’page’ ); } } } return $query; } add_action( … 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

Proper way to load styles using a child theme

If you want to prevent HELLO from loading it’s own styles, this is the code to paste and adjust in your child theme’s functions.php : function hello_elementor_scripts_styles() { // Dequeue parent theme stylesheets wp_dequeue_style( ‘hello-elementor’ ); wp_deregister_style( ‘hello-elementor’ ); wp_dequeue_style( ‘hello-elementor-theme-style’ ); wp_deregister_style( ‘hello-elementor-theme-style’ ); wp_dequeue_style( ‘hello-elementor-header-footer’ ); wp_deregister_style( ‘hello-elementor-header-footer’ ); // Enqueue only child … Read more

Remove product meta from single product page

If the code you provided is not working for other themes, it’s possible that the hooks or actions used by those themes are different. To remove product categories from the single product page using PHP, you can try the following code: function remove_product_meta() { remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_meta’, 40 ); } add_action( ‘init’, ‘remove_product_meta’ ); This … 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