0

I have created a custom theme and everything works fine except for the same erratic behaviour when I would like to browse the revisions of any of my content types (pages and posts revisions work fine).

I have enabled the revisions on the content types and they show fine. For instance, the Browse button for revisions for one of the content types post displays the following link (currently shows there are 5 revisions available)

http://localhost:8888/test_site/wp-admin/revision.php?revision=1582

When I click on it, it displays the All Posts admin listing:

enter image description here

I have disabled all plugins except for the 2 that I use (one is ACF and the other is my own plugin that defines the content types).

Other than defining revisions as part of the content type's features upon creation, I don't think there is another pre-req, so I am a bit baffled on why it does not display the revisions when the browse button is clicked - any ideas?

1

This had to do with the user not having the CPT capabilities access set up properly.

I was setting custom capabilities as such:

          'capabilities' => array(
            'publish_posts' => 'publish_' .$this->type,
            'edit_posts' => 'edit_' .$this->type,
            'edit_others_posts' => 'edit_others_' .$this->type,
            'edit_published_posts' => 'edit_published_' .$this->type,
            'delete_posts' => 'delete_' .$this->type,
            'delete_others_posts' => 'delete_others_' .$this->type,
            'read_private_posts' => 'read_private_' .$this->type,
            'edit_post' => 'edit_' .$this->type,
            'delete_post' => 'delete_' .$this->type,
            'read_post' => 'read_' .$this->type
        ),

In the code, ideally when the plugin is activate, I should've had a code that set the capability for the user I wanted (this is from the class I built, the options member has an array with the custom capabilities)

    $capabilities = $this->options['capabilities'];
    $admin_role = get_role( 'administrator' );
    $editor_role = get_role( 'editor' );
    foreach ( $capabilities as $capabilities => $capability_name ) {
        $admin_role->add_cap( $capability_name );
        // $editor_role->add_cap( $capability_name );
    }

Once I messed with these settings, the revisions worked as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.