Tagged: fields, seo, wpseo_pre_analysis_post_content, Yoast
- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by
Steve.
-
AuthorPosts
-
-
June 9, 2015 at 12:59 pm #3841
dre711MemberPosted this question to Twitter yesterday and got a slight response, but will all my fields get read by Yoast if run them through the wpseo_pre_analysis_post_content filter?
Can I have someone show an actual example of all fields being put through that filter?
Thanks.
-
June 9, 2015 at 1:16 pm #3842
SteveKeymaster@dre711– Welcome to the Piklist community!
Since Piklist does everything the WordPress way, any information you can find on the Yoast
wpseo_pre_analysis_post_contentfilter would work.Here’s what I found. Add this to your theme’s functions.php file or your main plugin file:
function my_custom_content_analysis($content) { global $post; return $content . ' ' . get_post_meta($post->ID, 'PIKLIST-FIELD-NAME', true); } add_filter('wpseo_pre_analysis_post_content', 'my_custom_content_analysis');The PIKLIST-FIELD-NAME is the
fieldparameter when in your field array.This code will only work with text, textarea and editor field. If you want to do something fancier, you may have to pull the post_meta and loop through the data.
Let us know if you need any more help.
-
June 9, 2015 at 1:42 pm #3844
dre711MemberSo are you saying for all my different fields created throughout a site to get read by Yoast, I would have to create a new function for each ‘PIKLIST-FIELD-NAME’? There’s not a global catch all my fields?
Thanks!
-
June 9, 2015 at 2:31 pm #3846
SteveKeymaster@dre711– This is really a question for Yoast, on the best way to add all your custom fields (Piklist or others) to his plugin.
However, I found this post that might help >.
Essentially, you can use the WordPress function get_post_custom to pull all your custom fields, and then loop through theme and add them to the $content parameter.
Does that make sense?
-
-
AuthorPosts
- The topic ‘All Fields Read by Yoast SEO?’ is closed to new replies.