Shortcodes not being parsed correctly when render function uses global $post
Please give us a description of what happened.
Hello, I have a shortcode in my page which outputs content based on the current page. There is no other content in the page. The shortcode render function uses the global $post to determine the content to be returned. This works exactly as desired on the frontend.
However, on the backend, yoast SEO plugins says "The text contains 0 words. This is far below the recommended minimum of 300 words. Add more content that is relevant for the topic."
When I change the plugin to not refer to global $post but pass the required data as attributes in the shortcode, yoast SEO works correctly.
Please describe what you expected to happen and why.
I expect yoast SEO to parse the shortcode correctly even when the shortcode render function uses global $post.
Technical info
- WordPress version: 4.8.1
- Yoast SEO version: 5.2
The global $post is not available in the admin, so you should be passing the required data as attributes in the shortcode.