Wordpress: Rewrite Line Code

Asked

Viewed 18 times

0

I need to rewrite a line of a Wordpress plugin using functions.php, I tried using add_filter but it doesn’t work.

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

$return = $post->post_title;

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

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

Is there any possibility for that?

1 answer

1

your plugin would need to be with a filter in the code

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

and you would apply this to your functions.php:

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

add_filter( 'my_plugin_post_title', 'uppercase_title');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.