Support » Plugins and Hacks » WordPress Access Areas » [Resolved] Access default per content type

[Resolved] Access default per content type

  • I’m using this plugin in one of my ‘real’ website. But I don’t know how to do it:
    – I’ve created a new custom content type “Product” using Pods plugin.
    – I created an access area “Temporary”
    – I want the all newly created Products always only can read and can edit by users that who can access “Temporary” area.

    How to do it?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author podpirate


    Hi Handoko,
    I didn’t build in a feature like ‘set access defaults for post type’, and I do not plan to do this in the near future.
    You might like write a tiny plugin or mu-plugin, where you can set the defaults “by hand”. It could look like this:

    function my_insert_post_data( $data , $postarr ) {
        extract( $data );
        if ( ! isset( $ID ) && $post_status == 'auto-draft' && $post_type == 'post' ) {
            // replace these with a wp-rolename, a capability or an access area of your choice
            $data['post_view_cap'] = 'my-access-area';
            $data['post_edit_cap'] = 'my-other-access-area';
            $data['post_comment_cap'] = 'my-third-access-area';
        return $data;
    add_filter( 'wp_insert_post_data' , 'my_insert_post_data' , 20 , 2 );

    You will need the access-areas corresponding capability.
    Just added a column in the Access-Areas table view, where you can copy-paste them.

    Thank you for your help. But I’m not good in PHP. For now, I will set the new posts private manually. If someday you have time and want to add new feature to the plugin, please consider it. I’m marking this topic as resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Access default per content type’ is closed to new replies.