Someone has built a custom plugin that adds a textarea on the admin/edit page, and a div on the pub page. I no longer have access to the person who built the custom plugin.

I have created a filter for the main page content by doing something like this:

function getHappy($content) { //goofy example
    str_replace(":)", "=^..^=", $content);
    return (is_single()) ? $content : $content;

add_filter('the_content', 'getHappy');

Where the_content is the hook for the main page content. How can I go about finding out what the hook for a plugin is? If it doesn't have one, is there a way to add one?

The problem is I am pulling live content with the filter, which means I cannot retrieve the data stored by the plugin, then alter it. It needs to be a 'live' filter.

Am I looking at this the wrong way? In this case is the_content not even used, but $content is? If it is the latter, is it as simple as finding the variable that holds the custom content?

These may be broad questions, but I hope the answer is fairly simple.

I am trying to do this in a way that won't break every time I update WP.

Cheers, Bo


So the answer was simple, though there may be a better way of dealing with it.

In the custom_display.php of the custom theme display page.

apply_filters ( 'the_content' , $theContentVar);

This may not be best practice, but it works. Hope it helps someone else...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.