Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @sergiourra Just put it to functions.php in your theme.

    Hello all, I did this solution, hope it help for someone.

    add_action('wp_loaded', 'show_all_filters');
    /**
     * List of all filters with their function names.
     */
    function show_all_filters()
    {
        remove_filter_by_method_name('filter_robots');
    }
    
    /**
     * Remove needed filter from list
     *
     * @param string $method_name Name of the method called to the filter.
     * @param int $priority Set the priorite from that filter if we need to remove just from it.
     *
     * @return void
     */
    function remove_filter_by_method_name(string $method_name, int $priority = 0)
    {
        global $wp_filter;
    
        if (isset($wp_filter['robots_txt']->callbacks) && is_array($wp_filter['robots_txt']->callbacks)) {
            foreach ($wp_filter['robots_txt']->callbacks as $callback_priority => $callback) {
                foreach ($callback as $function_key => $function) {
                    if ('filter_robots' === $function['function'][1]) {
                        $priority = 0 === $priority ? $callback_priority : $priority;
                        unset($wp_filter['robots_txt']->callbacks[$priority][$function_key]);
                    }
                }
            }
        }
    }

    Hello Russell, thank you for this topic. We will check and publish an update as soon as possible.

Viewing 3 replies - 1 through 3 (of 3 total)