has_shortcode cannot catch gallery
-
I’m trying to check if the post content has a gallery, and I’m very sure I have added a gallery via Gutenberg.
But when I use the below code to check, it tells me that there is no gallery in the post content.
global $post; if ( ! has_shortcode ( $post -> post_content, 'gallery' ) ) { echo 'No gallery'; }
Can you confirm if this is a bug?
Or is it possible to check all the shortcodes in the
post_content
and echo them so I can inspect them further?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘has_shortcode cannot catch gallery’ is closed to new replies.