Wordpress: Rewrite line of code

0

I need to rewrite a line from a Wordpress Plugin using functions.php, I tried to use add_filter but it does not work.

Basically I need to do so, this is an example of the original line:

$return = $post->post_title;

However, I need through the functions.php to leave it like this:

$return = strtoupper($post->post_title);

Is there any possibility for this?

    
asked by anonymous 01.10.2018 / 18:57

1 answer

1

Your plugin would need to have a filter in the code

$return = apply_filters('my_plugin_post_title', $post->post_title);

and you would apply in your functions.php this:

function uppercase_title( $title ) {
    return strtoupper($title);
}

add_filter( 'my_plugin_post_title', 'uppercase_title');
    
01.10.2018 / 22:25