WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a wordpress page that will output product details of a specific product from amazon: wordpress/product?asin=123

I'm just using the product page as a template and it really contains nothing. I'm just adding a filter to the content to put some contents into it.

I'm also using the wordpress seo plugin from yoast to take care of SEO stuff but it seems to be getting in the way. I currently have this code:

function ecom_title_filter($title){

            if($title == 'Product Details Page'){
                $asin = $_GET['asin'];
                $titles = get_titles($asin);
                if(count($titles) == 1){
                    $title = $titles[0];
                    $index = 1;
                    $title = '';
                    $title_count = count($titles);
                    foreach($titles as $item_title){

                        if($title_count > $index){
                            $title .= $item_title . ', ';
                            $title .= $item_title;





    return $title;

Then I'm adding it into the the_title and wp_title:

add_filter('the_title', 'ecom_title_filter');
add_filter('wp_title', 'ecom_title_filter');

The problem is that the page still retains the old page title which is Product Details Page and not the title that I'm returning from the method above. The method returns what I expect it to return so the problem is not the method. Any ideas?

share|improve this question
up vote 2 down vote accepted

Either deactivate the filter from the SEO plugin for that page with remove_filter() or use a later priority argument like this:

add_filter( 'the_title', 'ecom_title_filter', PHP_INT_MAX );
add_filter( 'wp_title',  'ecom_title_filter', PHP_INT_MAX );
share|improve this answer

Your Answer


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.