Yoast SEO WordPress Plugin - Get plugin generated data manually

0 votes

i wanted to get the yoast data manually  see example code below

This data is being generated by Yoast and automatically add it inside the head tag.

<!-- This site is optimized with the Yoast SEO plugin v4.2.1 - https://yoast.com/wordpress/plugins/seo/ -->
<meta name="description" content="bla bla bla"/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="http://example.localhost.com/" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="bla bla bla" />
<meta property="og:url" content="http://example.localhost.com/" />
<meta property="og:site_name" content="Example.com" />
<meta property="og:image" content="http://example.com.au/wp-content/uploads/2016/11/example.png" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="bla bla bla." />
<meta name="twitter:title" content="bla bla bla" />
<meta name="twitter:image" content="http://example.com.au/wp-content/uploads/2016/11/example.png" />
<script type='application/ld+json'>{"@context":"http:\/\/schema.org","@type":"WebSite","@id":"#website","url":"http:\/\/example.localhost.com\/","name":"Example","potentialAction":{"@type":"SearchAction","target":"http:\/\/example.localhost.com\/?s={search_term_string}","query-input":"required name=search_term_string"}}</script>
<!-- / Yoast SEO plugin. -->

I do not want to use wp_head(); because it also generates other scripts, styles and whatever plugin or code you have in your wordpress website.

. I only want to get the Yoast SEO generated code as shown above.


Feb 11 in Others by Kichu
• 19,040 points
110 views

1 answer to this question.

0 votes

get_post_meta(), use this to get the meta yoast in the page 

echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); 
echo get_post_meta(get_the_ID(), '_yoast_wpseo_title', true);  
and you this code to get the meta values to get the values related to each page just check the  post meta tables 
answered Feb 11 by narikkadan
• 18,880 points

Related Questions In Others

0 votes
1 answer

adding meta keyword in wordpress using yoast seo plugin.

You can use Advance Custom Fields plugin ...READ MORE

answered Feb 28 in Others by narikkadan
• 18,880 points
166 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
• 18,880 points
622 views
0 votes
1 answer

Detect Yoast SEO plugin

if(in_array('wordpress-seo/wp-seo.php', apply_filters('active_plugins', get_option('active_plugins')))){     /* Yoast is active ...READ MORE

answered Feb 14 in Others by narikkadan
• 18,880 points
131 views
0 votes
1 answer
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
• 18,880 points
279 views
0 votes
1 answer

Simple question regarding PHP, Wordpress & Yoast SEO

the way the search engine displays your ...READ MORE

answered Feb 14 in Others by narikkadan
• 18,880 points
46 views
0 votes
1 answer

how can I change yoast seo generated sitemap file URL?

plugins/wordpress-seo/inc/sitemaps/class-sitemaps-router.php go to this directory and change the ...READ MORE

answered Feb 22 in Others by narikkadan
• 18,880 points
694 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
• 18,880 points
403 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
• 18,880 points
150 views
0 votes
1 answer

Setting a custom canonical URL in Yoast Wordpress SEO Plugin

function design_canonical($url) { global ...READ MORE

answered Feb 27 in Others by narikkadan
• 18,880 points
243 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