Change WordPress user roles and capabilities Forums Bug Reports Access restricted for Administrator from custom post type in Divi Theme

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2260
    SilverwoodMedia
    Participant

    The administrator has all permissions. I have set Force custom post types to use their own capabilities

    /wp-admin/edit.php?post_type=et_pb_layout

    Cheating, are we?
    You are not allowed to edit posts in this post type.

    et_pb_layout is not an option in UREPro.

    Switching force cpt off remedies the problem.

    #2261
    Vladimir
    Keymaster

    Thanks for this information. I repeated the issue at my test environment. I will inform you as I prepare the fix.

    #2262
    Vladimir
    Keymaster

    Divi theme load its framework (create custom post type et_pb_layout) conditionally:

    
    function et_builder_should_load_framework() {
    	global $pagenow;
    
    	$is_admin = is_admin();
    	$action_hook = $is_admin ? 'wp_loaded' : 'wp';
    	$required_admin_pages = array( 'edit.php', 'post.php', 'post-new.php', 'admin.php', 'customize.php', 'edit-tags.php', 'admin-ajax.php', 'export.php' ); // list of admin pages where we need to load builder files
    	$specific_filter_pages = array( 'edit.php', 'admin.php', 'edit-tags.php' ); // list of admin pages where we need more specific filtering
    
    	$is_edit_library_page = 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && 'et_pb_layout' === $_GET['post_type'];
    	$is_role_editor_page = 'admin.php' === $pagenow && isset( $_GET['page'] ) && apply_filters( 'et_divi_role_editor_page', 'et_divi_role_editor' ) === $_GET['page'];
    	$is_import_page = 'admin.php' === $pagenow && isset( $_GET['import'] ) && 'wordpress' === $_GET['import']; // Page Builder files should be loaded on import page as well to register the et_pb_layout post type properly
    	$is_edit_layout_category_page = 'edit-tags.php' === $pagenow && isset( $_GET['taxonomy'] ) && 'layout_category' === $_GET['taxonomy'];
    
    	if ( ! $is_admin || ( $is_admin && in_array( $pagenow, $required_admin_pages ) && ( ! in_array( $pagenow, $specific_filter_pages ) || $is_edit_library_page || $is_role_editor_page || $is_edit_layout_category_page || $is_import_page ) ) ) {
    		return true;
    	} else {
    		return false;
    	}
    
    }
    

    So ‘et_pb_layout’ CPT is not available by default at User Role Editor page, which is loaded from users.php

    I add a workaround for this issue into upcoming version 4.25, which is under testing currently. So the issue will be resolved with the next public release of URE Pro.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.