chazuk / wp-api-yoast-meta Goto Github PK
View Code? Open in Web Editor NEWAdds the Yoast fields for pages and posts to the WP-API response
Adds the Yoast fields for pages and posts to the WP-API response
We recently forked to add support for this. The issue comes with OpenGraph data being configured on the backend, but not rendered under the yoast_meta
data in the REST API.
I should have a PR for this shortly.
Hi,
I have everything working on this except custom post categories. Has anybody fixed this locally?
Thanks
Hi,
first thank you so much for this great plugin, really.
I'd like to ask you how could I solve the issue related to the update of the 'yoast_wpseo_metadesc' for tags.
if I create a post, your plugin successfully update the field 'yoast_wpseo_metadesc', but if I create a new tag, the tag get created, but the metadescription is not.
Could you please help to undestand why and how could I do it?
Here an example of my code:
tag_post = {
'name': 'my new tag''
'description': '<p>This is the tag description</p>',
'yoast_meta': {
'yoast_wpseo_metadesc': 'THIS SHOULD BE THE METADESCRIPTION',
} ,
}
r = requests.post(url + '/tags', headers=header, json=tag_post)
Just to let you know that looking at the endpoints in /wp-json/wp/v2/tags, your plugin added correctly the field 'yoast_wpseo_metadesc', but I cannot edit it using the POST method.
PS: I did not test the same approch with categories (/wp-json/wp/v2/categories), but maybe I guess that if it does not work with tags, maybe the same issue could be also while creating yoast metadescription for categories
thank you in advance
I am trying to figure out how to get my open graph title and twitter title to display correctly from the WordPress API. Here is my api endpoint.
http://editors.befunky.com/wp-json/wp/v2/posts
Everything is under the yoast_meta
array. I am running WordPress 5.1.1 and the lastest versions of the Yoast SEO and Yoast Meta plugins.
For some reason the og:title
reads Designer - Call to Action Block | BeFunky Blog
, rather than Post Title | Site Title
. I have an identical local setup and it outputs the correct data.
Any thoughts on where I might start looking?
I know that this plugin hasn't been tested with this version of WP, but I thought I'd post this in case you plan on updating. Yoast itself has vague plans to support the WP REST API themselves, but no timeline that I can see. Yoast/wordpress-seo#3061
Yoast data is coming back empty for every field.
{
id: 141,
date: "2017-09-06T16:38:35",
date_gmt: "2017-09-06T16:38:35",
...
yoast: {
focuskw: "",
title: "",
metadesc: "",
linkdex: "",
metakeywords: "",
meta-robots-noindex: "",
meta-robots-nofollow: "",
meta-robots-adv: "",
canonical: "",
redirect: "",
opengraph-title: "",
opengraph-description: "",
opengraph-image: "",
twitter-title: "",
twitter-description: "",
twitter-image: ""
}
}
The Yoast fields should contain the values the plugin would normally add to the HEAD of the document.
<title>Test Page Stuff - name name</title>
<!-- This site is optimized with the Yoast SEO plugin v5.4 - https://yoast.com/wordpress/plugins/seo/ -->
<!-- Admin only notice: this page doesn't show a meta description because it doesn't have one, either write it for this page specifically or go into the SEO -> Titles menu and set up a template. -->
<meta name="robots" content="noindex,follow">
<link rel="canonical" href="http://vccw.dev/test-page-stuff/">
<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="Test Page Stuff - name name">
<meta property="og:description" content="lakjfao;wueoc orjaocnugnzlosio;ohgrhoi">
<meta property="og:url" content="http://vccw.dev/test-page-stuff/">
<meta property="og:site_name" content="name name">
<meta property="article:publisher" content="https://www.facebook.com/namename/">
<meta name="twitter:card" content="summary">
<meta name="twitter:description" content="lakjfao;wueoc orjaocnugnzlosio;ohgrhoi">
<meta name="twitter:title" content="Test Page Stuff - name name">
<meta name="twitter:site" content="@namename">
<meta name="twitter:creator" content="@namename">
<script type="application/ld+json">{"@context":"http:\/\/schema.org","@type":"WebSite","@id":"#website","url":"http:\/\/vccw.dev\/","name":"name name","alternateName":"name name at the name Arcade in Norfolk, VA","potentialAction":{"@type":"SearchAction","target":"http:\/\/vccw.dev\/?s={search_term_string}","query-input":"required name=search_term_string"}}</script>
<script type="application/ld+json">{"@context":"http:\/\/schema.org","@type":"Organization","url":"http:\/\/vccw.dev\/test-page-stuff\/","sameAs":["https:\/\/www.facebook.com\/namename\/","https:\/\/www.instagram.com\/namename\/","https:\/\/twitter.com\/namename"],"@id":"#organization","name":"name name","logo":""}</script>
<!-- / Yoast SEO plugin. -->
</head>
If I override the defaults in the Yoast plugin on the page, then the new value shows up.
Hello,
I need to add those rest fields to woocommerce product category, so I added this code ๐
// Product cat
register_rest_field( 'product_cat',
'yoast_meta',
array(
'get_callback' => array( $this, 'wp_api_encode_yoast_tag' ),
'update_callback' => null,
'schema' => null,
)
);
In the add_yoast_data function but it did not work, I can't fill those fields from the rest API (it works with posts, pages..)
Did I miss something ?
Thanks
I am using wp-api-yoast-meta to post the following data to my.site/wp-json/wp/v2/tags
.
data = {
"name": "Tag name",
"description": "Tag description",
"slug": "tag-name",
"yoast": {
"yoast_wpseo_title": "Not working yoast title",
"yoast_wpseo_metadesc": "Not working yoast description"
}
}
While name
, description
, slug
are created or updated yoast_wpseo_
fields are not.
Is my data structure wrong?
Hello,
I've found you plugin really helpfull but I have no clue about wordpress. Do you think there's a way to return yoast info in categories from woocommerce?
Hi,
I try to find a way to use the REST API to create new post and fill up the fields that let define a primary category.
yoast_wpseo_primary
Can i do this with your plugin ?
if not, any idea how i could do this ?
Thanks a lot
Your plugin save me the day, but I cannot find it on https://wordpress.org/plugins/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.