• Resolved himeka

    (@himeka)


    I get the same error as @alicekhin.
    https://wordpress.org/support/topic/notice-undefined-property-wp_post_typeid-in-all-in-one-seo-pack-tags-php/

    Warning: Undefined property: WP_Post_Type::$ID in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 932
    Warning: Undefined property: WP_Post_Type::$ID in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 934
    Warning: Undefined property: WP_Post_Type::$ID in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 934
    Warning: Undefined property: WP_Post_Type::$ID in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 936
    Warning: Undefined property: WP_Post_Type::$display_name in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 939
    Warning: Undefined property: WP_Post_Type::$first_name in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 942
    Warning: Undefined property: WP_Post_Type::$last_name in /var/www/html/wp-content/plugins/all-in-one-seo-pack-pro/app/Common/Utils/Tags.php on line 945

    When I select “mine” in the post list on the admin screen, an error is displayed.
    Also, when I filter by username, I get the same error.
    Username filtering is a customization added in function.php.
    It doesn’t seem to matter because the error doesn’t disappear even if the user name filtering is deleted.

    function add_author_filter() {
    	global $post_type;
    	if ( 'post' === $post_type ) {
    		wp_dropdown_users(
    			array(
    				'show_option_all' => 'ユーザー一覧',
    				'name'            => 'author',
    			)
    		);
    	}
    }
    add_action( 'restrict_manage_posts', 'add_author_filter' );

    I’m adding archive.php customizations to function.php.
    If you remove this customization, the error will disappear. But my WordPress needs this customization.

    function post_has_archive( $args, $post_type ) {
    	if ( 'post' === $post_type ) {
    		$args['rewrite']     = true;
    		$args['has_archive'] = 'blog';
    	}
    	return $args;
    }
    add_filter( 'register_post_type_args', 'post_has_archive', 10, 2 );

    How can I get rid of the error while leaving the archive.php customizations? Help me.

    • This topic was modified 4 years, 7 months ago by himeka.
    • This topic was modified 4 years, 7 months ago by himeka.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author arnaudbroes

    (@arnaudbroes)

    Hey @himeka,

    Thank you for reporting this.

    Obviously our plugin is running into errors because it’s expecting a WP_User object but instead getting a WP_Post_Type object. However, I think we can work around this on our end by checking what type of object we have before trying to extract the author’s info. That way, we should be able to at least suppress any errors you see when your site is modifying the default behaviour.

    Does that make sense to you? I’ve opened an issue so that we can address this. In the meanwhile, unfortunately there’s not much you can do to hide these errors. I would recommend disabling WP_DEBUG in your wp-config.php file.

    Thread Starter himeka

    (@himeka)

    Thank you @arnaudbroes.

    I hope this problem will be resolved.

    I decided to disable WP_DEBUG in the wp-config.php file.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Notice: Undefined property: WP_Post_Type::$ID in all-in-one-seo-pack tags.php’ is closed to new replies.