Skip Navigation

[Résolu] SEO by Yoast doesn't find my custom post type fields

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 6 réponses, has 2 voix.

Last updated by christerA Il y a 6 années et 6 mois.

Assigned support staff: Minesh.

Auteur
Publications
#299145

Hi.

Love Toolset. I have a question about SEO by Yoast. I have created a custom post type with Toolset with
"description", "excerpt", "date", etc.

And i have filled in keyword, meta, etc in Yoast. But when i click Page Analysis in Yoast it says "0 words in the content" (and with the red dot...)

It seems Yoast doesn't find the content in my "description" field although i have lots of words in it.

What have i missed?

#299317

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello and thank you for contacting support forum.

1)
Could you please send me few screenshots explaining your issue or steps to reproduce your issue.

2)
I would like to have debug information that will help us to debug and investigate your issue:
=> http://wpml.org/faq/provide-debug-information-faster-support/

#299368

Hi.

Thank you for answering.
To reproduce the problem:
- Install Types
- Install WordPress SEO by Yoast https://wordpress.org/plugins/wordpress-seo/
- Create a custom post type
- Create a custom field, like "description"
- Create a post with that custom post type
- Type in some text in "description"
- Below that area (or above) you will see a widget called "WordPress SEO by Yoast"
- Fill in Focus-keyword, SEO-title and Meta
- Save the page
- Go back to the widget and click "Page analysis"
- Then you will see a red dot and "0 words in content...."

Thats it. WordPress SEO by Yoast can't find the "description" text. For "normal" pages, that is, not custom post type pages, it works fine.

I have contacted Yoast but they only give support if you buy the premium version of their plugin.....

#299918

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I checked your issue at this end on my local and I could not able to reproduce your issue, Could you please send me debug information.
=> https://toolset.com/faq/provide-debug-information-faster-support/

#300039

Hi.

I finally got a reply from Yoast:
---------------------------------------
Thanks for emailing us! In a way, Types acts much like a page builder. So in regards to that, by default, our plugin does not analyze content that is outside of the main content box of a page or post. Some visual composer developers have modified their code to add compatibility with our plugins while others have not.
If you are using a plugin or theme that doesn't send their content to our page analysis, please reach out the developer and ask them about adding the functionality to their visual builder.
Additionally, our Knowledge Base touches up on this - hidden link
Basically you'd have to put together a filter so those content blocks will be picked up.
---------------------------------------
Click on the links they supplied.
The code below is at: hidden link

I tried the code they suggested:

function yst_custom_content_analysis( $content ) {
global $post;
return $content . ' ' . get_post_meta( $post->ID, '_yoast_postmeta_example', true );
}
add_filter( 'wpseo_pre_analysis_post_content', 'yst_custom_content_analysis' );

I still didn't get it to work.
Example:
If i create a custom post type with Types with the name "myposttype" and add a custom field named "mydescription". And fill in some text in that field.
What exactly shall i put in the code above to make Yoast "Page analysis" find that text?

--------------------------------
I tried an alternative to using a custom field for the main text. When i created the custom post type above, I did NOT click "Editor". (in the section with the checkboxes "Title", "Editor", "Comments", ...etc)
When i checked the "Editor" field and then copied my text from the "mydescription" custom field area to the normal "Editor" area, it worked! Yoast found it in "Page analysis".
But it would be very nice if it found All my custom fields.

#300261

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I have tested below code and add to the current theme's functions.php file. where "wpcf-summary" is the custom field for me.

function yst_custom_content_analysis( $content ) {
global $post;
return $content . ' ' . get_post_meta( $post->ID, 'wpcf-summary', true );
}
add_filter( 'wpseo_pre_analysis_post_content', 'yst_custom_content_analysis' );

Can you please try to put your custom field instead of 'wpcf-summary' and check your issue. Its working at this end.

#300291

Thanks!