WordPress.org

Ready to get started?Download WordPress

Forums

WP Document Revisions
[resolved] Notice: Trying to get property of non-object in on line 1369 (3 posts)

  1. simonhayre
    Member
    Posted 1 year ago #

    Got this

    Notice: Trying to get property of non-object in /wp-content/plugins/wp-document-revisions/wp-document-revisions.php on line 1369

    Found this issue here:

    function add_revision_num_to_title( $title ) {
    		global $post;
    
    		//verify post type
    		if (!$this->verify_post_type() )
    			return $title;
    
    		//if this is a document, and not a revision, just filter and return the title
    		if ($post->post_type != 'revision' ) {
    
    			if ( is_feed() )
    				$title = sprintf( __( '%s - Latest Revision', 'wp-document-revisions'), $title );
    
    			return apply_filters( 'document_title',  $title );
    
    		}

    Can we change to this....?

    function add_revision_num_to_title( $title ) {
    		global $post;
    
    		//verify post type
    		if (!$post || !$this->verify_post_type() )
    			return $title;
    
    		//if this is a document, and not a revision, just filter and return the title
    		if ($post->post_type != 'revision' ) {
    
    			if ( is_feed() )
    				$title = sprintf( __( '%s - Latest Revision', 'wp-document-revisions'), $title );
    
    			return apply_filters( 'document_title',  $title );
    
    		}

    http://wordpress.org/extend/plugins/wp-document-revisions/

  2. simonhayre
    Member
    Posted 1 year ago #

    Issue occures when the site has never had a document uploaded.

  3. Ben Balter
    Member
    Plugin Author

    Posted 1 year ago #

    Fix looks valid.

    If no documents are uploaded, how are you getting this error? I believe this function would only fire on the_title filter, which would only be triggered if there's a post to filter?

    Created a GitHub bug for this issue to track, closing here for now.

    https://github.com/benbalter/WP-Document-Revisions/issues/36

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags