admin管理员组文章数量:1415684
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:
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?
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:
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?
Share Improve this question asked May 13, 2019 at 23:49 csaboriocsaborio 1122 silver badges13 bronze badges1 Answer
Reset to default 2This 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.
本文标签: Browsing Revisions in Custom Post Types takes me Empty Post Listing
版权声明:本文标题:Browsing Revisions in Custom Post Types takes me Empty Post Listing 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745238779a2649195.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论