Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Bug in ewdufaqInit::alter_faq_content()

$
0
0

Replies: 0

Hello,

The plugin assumes that there will be global $post set in ewdufaqInit::alter_faq_content(), but that’s not necessarily true, as the_content hook might be called on non-global WP_Post object. This may trigger PHP Notice in some circumstances. Please alter the code to from:


public function alter_faq_content( $content ) {
		global $post, $ewd_ufaq_controller;

		if ( $post->post_type != EWD_UFAQ_FAQ_POST_TYPE ) { return $content; }

to


public function alter_faq_content( $content ) {
		global $post, $ewd_ufaq_controller;

		if ( !isset($post) || $post->post_type != EWD_UFAQ_FAQ_POST_TYPE ) { return $content; }
  • This topic was modified 16 minutes ago by matt_fw.

Viewing all articles
Browse latest Browse all 59525

Trending Articles