• Dear Rafael,

    I would like to commit a little patch for three undefined variable or null warnings:

    in superior-faq.php

    @@ -268,7 +268,7 @@ if(!class_exists('Superior_FAQ')) {
     
                            global $post;
     
    -                       if($post->post_type == 'faq') {
    +                       if(isset($post->post_type) && $post->post_type == 'faq') {
                                    //get selected template for faqs posts
                                    $settings = get_option( 'superior_faq_settings' );
     
    @@ -292,8 +292,9 @@ if(!class_exists('Superior_FAQ')) {
     
                            global $post;
     
    -                   if ( is_admin() || $post->post_type != 'faq' ) return;
    +                   if ( is_admin() || (isset($post->post_type) && $post->post_type != 'faq') ) return;
                        if ( empty ( $post_id) ) {
    +                       if (! isset($post->ID) ) return;
                            $post_id = $post->ID;
                        }
     
    @@ -315,7 +316,7 @@ if(!class_exists('Superior_FAQ')) {
                    public function faq_content_filter( $content ) {
     
                            global $post;
    -                       if($post->post_type == 'faq') {
    +                       if(! is_null($post) && $post->post_type == 'faq') {
     
                                    $settings = get_option( 'superior_faq_settings' );
     
    

The topic ‘patch for three undefined variable or null warnings’ is closed to new replies.