wc_post_content_has_shortcode( string $tag = '' )

Checks whether the content passed contains a specific short code.


Description Description


Parameters Parameters

$tag

(Optional) Shortcode tag to check.

Default value: ''


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/wc-conditional-functions.php

function wc_post_content_has_shortcode( $tag = '' ) {
	global $post;

	return is_singular() && is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, $tag );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.