Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am running a plugin from a WP page to execute PHP and it works great. I'd like to edit the page title and description based on POST data. I am already using POST data in the PHP code to alter the page output and it works great but if I try to insert POST data in the following function to alter the page it doesn't do anything. I just need to be able to change the meta description and page title on the fly with POST data.

This code exists in the PHP on my page:

add_filter('wp_title', 'set_page_title');

function set_page_title($orig_title) { 
    return 'Modified ' . $orig_title;
}
share|improve this question

1 Answer 1

Put it in functions.php or at the top of the header.php in your theme. What I suspect is that the wp_title() method in header.php is already executed by the time your add_filter() is called.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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