0
votes

I need to add a filter to a specific wordpress function which is defined in a file which is included by a pluggable function theme's functions f

functions.php:

if (!function_exists('nectar_colors_css_output')) {
    function nectar_colors_css_output(){
        include('css/colors.php');
    }
}

colors.php:

<?php 
function nectar_colors() {
    // not relevant what happens here, but I have 
    // to call another function before this one is called!
}
?>

I use a child theme and when I try to filter this function from the child theme's functions.php, nothing happens. This is because pluggable functions of the parent theme will be called after calling the filters from the child theme.

My filter function in the child theme's functions.php is

function filter_function() {
  // some custom actions...
}
add_filter('nectar_colors', 'filter_function');

How can I get this filter working?

1

1 Answers

0
votes

What exactly are you trying to filter on? You might be misunderstanding the concepts.

Take your example provided. The parent checks if a function exists before creating it. So basically, if you define it in your child's theme, the parent will know it's there and won't create a default one.

#themename-child

function nectar_colors_css_output(){
    error_log("It worked!");
}