meta title problem

#677341
  • Resolved Anonymous
    Rank Math free

    hi, i have 2 problem…
    1- How to change the “schema title” of the product?
    I want %sitename% not to be in the product schema headline, be only %title%, I found it for the post, but I don’t know where it is for the product.

    2- I want to change the “title” of the products belonging to a certain category and add a word to the beginning of it, how?
    word: photo of

Viewing 15 replies - 1 through 15 (of 23 total)
  • Hello,

    I’m sorry to hear about the issues you’re facing. I can help you with that.

    To change the “schema title” of the product, you can navigate to your WordPress Dashboard, then go to Rank Math SEO → Titles & Meta → Products. Here, you can set the Schema Type to WooCommerce Product and customize the schema title. Once done, remember to click Save Changes.

    As for changing the “title” of the products belonging to a certain category and adding a word to the beginning of it, you can do this by editing the product name in WooCommerce. You can navigate to WordPress Dashboard → Products and click on the applicable product. Then, you can edit the product name and add the word “photo of” at the beginning.

    I hope this helps! If you have any further questions or need additional assistance, feel free to ask.

    Sources:
    Resolving Rank Math Schema Markup Related Issues
    How to Use Product Schema for WooCommerce Products » Rank Math
    How to Customize Schema Markup for WooCommerce Products » Rank Math

    Hello,

    Thank you for contacting us and bringing your concern to our attention.

    1. The product schema title is taken from the Single Product Title in Rank Math > Titles & Meta > Products. However, if you only want to use the %title% in the product schema then you can add the following filter on your website:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
    	$entity['name'] = get_the_title();
    	return $entity;
    });
    

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    2. You can change the individual product title from the Rank Math SEO meta box Edit Snippet under a specific category. https://rankmath.com/kb/seo-meta-tags/#classic-editor

    We also have a CSV bulk edit option but this is only available in the PRO version of the plugin: https://rankmath.com/kb/editing-seo-meta-at-scale/

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    Anonymous
    Rank Math free

    1- tnx its worked, but in rich results test, i have one table to show me title with %sitename%
    I don’t know, I just want to make sure everything is working properly
    its:
    rich results test

    2- No, I don’t really want to change the title or seo title of the products of a specific category! I just want to apply the title tag to their source page and it’s always adjustable!
    If I want to give you an example, right now in: Rank Math SEO → Titles & Meta → Products
    The title of the products can be changed, now I want the same for the products of a specific category!

    Hello,

    1. Please try the code below instead and see if that works for you:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
    	
    	$entity['name'] = get_the_title();
    	if($entity['mainEntityOfPage']){
    		$entity['mainEntityOfPage']['name'] = get_the_title();
    	}
    	
     	return $entity;
    });

    2. You can do this using our filter code as well since you only want to change the title of the products with specific categories.

    The code would be like this:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
    
    	$terms = wp_get_post_terms( $post->ID, 'product_cat' );
    	foreach ( $terms as $term ) $categories[] = $term->slug;
    	
    	if ( in_array( 'some product category', $categories ) ) {
    		$entity['name'] = get_the_title();
    		if($entity['mainEntityOfPage']){
    			$entity['mainEntityOfPage']['name'] = get_the_title();
    		}
    	}
    	
     	return $entity;
    });

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Anonymous
    Rank Math free

    1- I tested the new code, but it still shows the name field in mainEntityOfPage with %sitename%
    I will upload a picture with a higher angle of view for you and I have selected the problem:
    rr test

    2- Thank you, just how should I add the category and the word I want?
    I want the titles to be like this: photo of %title% %sep% %sitename%
    my category id: 1502
    my category slug: site.com/c/phone
    my product title in rankmath settings: %title% %sep% %sitename%

    And the schema title of these products that belong to this category should be: photo of %title%

    Hello,

    In this case we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Anonymous
    Rank Math free

    As you requested, I have sent you all the information along with the details

    Hello,

    I added the following filter to your site, and now only the product title is used for the mainEntityOfThePage property:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if(is_product()) {
    		$data['WebPage']['name'] = get_the_title();
    		return $data;
    	}
    	return $data;
    }, 9999, 2);

    Please check and let us know if you need our assistance with anything else.

    Anonymous
    Rank Math free

    Thanks, just one more question about it.
    Which code do we need now?

    A-

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
    	$entity['name'] = get_the_title();
    	return $entity;
    });
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if(is_product()) {
    		$data['WebPage']['name'] = get_the_title();
    		return $data;
    	}
    	return $data;
    }, 9999, 2);

    OR
    B-

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
    	
    	$entity['name'] = get_the_title();
    	if($entity['mainEntityOfPage']){
    		$entity['mainEntityOfPage']['name'] = get_the_title();
    	}
    	
     	return $entity;
    });
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if(is_product()) {
    		$data['WebPage']['name'] = get_the_title();
    		return $data;
    	}
    	return $data;
    }, 9999, 2);

    Hello,

    Since modifying the mainEntityOfPage using the hook rank_math/snippet/rich_snippet_product_entity didn’t work at first, you can go ahead and stick with method A.

    Let us know how that goes. Looking forward to helping you.

    Anonymous
    Rank Math free

    Thanks, my first problem is completely solved.
    But my second problem still exists, I describe the second problem again here (if you scroll up you will get more details):

    I want the title of the products of a specific category to be like this: photo of %title% %sep% %sitename%
    my category id: 36
    my category slug: site.com/c/iphone
    my product title in rankmath settings: %title% %sep% %sitename%

    And the schema title of these products that belong to this category should be: photo of %title%

    Hello,

    In that case, please replace the filters shared before with the following ones:

    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	global $post;
            $term = get_the_terms( $post->ID, 'product_cat' );
            $term_id = wp_list_pluck($term, 'term_id');
            if(in_array('36', $term_id)) {
                    $entity['name'] = 'Photo of '.get_the_title();
    	        return $entity;
            }
    	$entity['name'] = get_the_title();
    	return $entity;
    });
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
            global $post;
    	if(is_product()) {    
                  $term = get_the_terms( $post->ID, 'product_cat' );
                  $term_id = wp_list_pluck($term, 'term_id');
                  if(in_array('36', $term_id)) {
                         $data['WebPage']['name'] = 'Photo of '.get_the_title();
    	             return $data;
                  }
    		$data['WebPage']['name'] = get_the_title();
    		return $data;
    	}
    	return $data;
    }, 9999, 2);

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Anonymous
    Rank Math free

    omgg, if this is your free service, then what is your premium service? im happy and recommend rankmath to everyone…

    Let’s go… I replaced and tested the new code, the rest of the products work correctly, but it didn’t change the title of the products belonging to a specific category.
    but it changed the title schema of the products belonging to a specific category.

    now we have two problem:
    1- title of the products belonging to a specific category
    2- one of tables for schema title of the products belonging to a specific category:
    name-itemListElement
    itemListElement->name should be: photo of %title%

    And also to say that the sensitive information is still active and the product link belongs to the same category and problem

    Hello,

    To update the SEO title of the category, please use the following filter:

    add_filter( 'rank_math/frontend/title', function( $title ) {
            global $post;
    	if(is_product()) {    
                  $term = get_the_terms( $post->ID, 'product_cat' );
                  $term_id = wp_list_pluck($term, 'term_id');
                  if(in_array('36', $term_id)) {
    	             return 'Photo of '.$title;
                  }
    	return $title;
    });

    To update the title in the itemListElement property of the Breadcrumbs, use this one:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	global $post;
    	if(is_product()) {    
                  $term = get_the_terms( $post->ID, 'product_cat' );
                  $term_id = wp_list_pluck($term, 'term_id');
                  if(in_array('36', $term_id)) {
    	              $crumbs[count($crumbs)-1][0]= 'Photo of '.get_the_title();
    				  return $crumbs;
                  }
    	return $crumbs;
    }, 10, 2);
    

    The filter will update both the Breadcrumbs and the Breadcrumbs Schema.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

Viewing 15 replies - 1 through 15 (of 23 total)

The ticket ‘meta title problem’ is closed to new replies.