How to echo WP SEO Yoast synonyms in PHP

0 votes

I need to print a page including WPSEO information's, for translation. I am trying to output WPSEO information in PHP, and I have managed for title, description, focus keywords, but it does not work for synonyms (nothing comes out). There seems to be no Meta for synonym, so how to get it?

<div id="print-seo">
Title: "<?php echo WPSEO_Meta::get_value("title"); ?>"<br />
Description: "<?php echo WPSEO_Meta::get_value("metadesc"); ?>"<br />
Focus Keyword: "<?php echo WPSEO_Meta::get_value("focuskw"); ?>"<br />
Synonyms: "<?php echo WPSEO_Meta::get_value("synonyms"); ?>"<br />
Feb 23 in Others by Kichu
• 16,850 points
44 views

1 answer to this question.

0 votes
Title: "<?php echo WPSEO_Meta::get_value("title"); ?>"<br />
Description: "<?php echo WPSEO_Meta::get_value("metadesc"); ?>"<br />
Focus Keyword: "<?php echo WPSEO_Meta::get_value("focuskw"); ?>"<br />
Synonyms: "<?php echo substr(get_post_meta( $post->ID, '_yoast_wpseo_keywordsynonyms', true ), 2, -5); ?>"<br />
</div>```


I came up with this code seeing  meta_key in wp_postmeta table is _yoast_wpseo_keywordsynonyms and it worked for me 
answered Feb 24 by narikkadan
• 7,860 points

Related Questions In Others

0 votes
1 answer

How to Access Yoast SEO tags in Wordpress API Callback

use rest api to request for the ...READ MORE

answered Feb 12 in Others by narikkadan
• 7,860 points
54 views
0 votes
1 answer

How to add meta keyword in wordpress using yoast seo plugin.?

if you dont want to use code ...READ MORE

answered Feb 12 in Others by narikkadan
• 7,860 points
76 views
0 votes
1 answer

How to add a class to the <a> tag in Yoast SEO breadcrumbs?

add_filter( 'wpseo_breadcrumb_single_link', 'ss_breadcrumb_single_link', 10, 2 ); function ss_breadcrumb_single_link( ...READ MORE

answered Feb 22 in Others by narikkadan
• 7,860 points
55 views
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11 in Others by narikkadan
• 7,860 points
340 views
0 votes
1 answer

Problem with yoast SEO

This is (probably) not a problem of ...READ MORE

answered Feb 10 in Others by narikkadan
• 7,860 points
22 views
0 votes
1 answer

how to show the <meta> values of yoast seo with some function?

check this folder : wordpress-seo\src\presenters\open-graph you can ...READ MORE

answered Feb 10 in Others by narikkadan
• 7,860 points
50 views
0 votes
1 answer

Yoast SEO remove og description and twitter description on certain page

try this out it wil help ...READ MORE

answered Feb 11 in Others by narikkadan
• 7,860 points
41 views
0 votes
1 answer

Removing canonical tag added by Yoast SEO plugin

first  Log in to your WordPress website ...READ MORE

answered Feb 11 in Others by narikkadan
• 7,860 points
162 views
0 votes
1 answer

How to echo WP SEO Yoast synonyms in PHP?

 the meta_key in wp_postmeta table is _yoast_wpseo_keyword ...READ MORE

answered Feb 10 in Others by narikkadan
• 7,860 points
60 views
0 votes
1 answer

How to copy title of WP post dynamically to focus keyword field in Yoast SEO?

$title = get_the_title(); $args = array('posts_per_page' => -1, ...READ MORE

answered Feb 24 in Others by narikkadan
• 7,860 points
58 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP