WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / Technical: Child Theme / Technical – How to Grant Access to Custom Post Type Capabilities for a Specific Role after 5.1.1 Theme Update

Technical – How to Grant Access to Custom Post Type Capabilities for a Specific Role after 5.1.1 Theme Update

563 views 0

If you need to give specific user roles (like Editor) the ability to manage a custom post type like estate_property (properties) from Wp-Admin after 5.1.1 WpResidence theme update, you have two options:

Option 1: Use a Plugin (No Code Required)

You can use the free Members plugin by MemberPress to manage roles and capabilities through a visual interface.

Steps:

  1. Install and activate the Members plugin.

  2. Go to Members > Roles in your WordPress Dashboard.

  3. Edit the desired role (e.g., Editor).

  4. Check the capabilities you want to assign (like edit_estate_property, publish_estate_properties, etc.).

  5. Save changes.

Option 2: Add Custom Code (for Developers)

If you prefer to use code, add the following snippet to your child theme’s functions.php file or a custom plugin:

add_action('init', function () {
    $role = get_role('editor'); // Change to 'administrator' or another role if needed

    if (!$role) return;

    $capabilities = array(
        'edit_estate_property',
        'read_estate_property',
        'delete_estate_property',
        'edit_estate_properties',
        'edit_others_estate_properties',
        'publish_estate_properties',
        'read_private_estate_properties',
        'create_estate_properties',
        'delete_estate_properties',
        'delete_private_estate_properties',
        'delete_published_estate_properties',
        'delete_others_estate_properties',
        'edit_private_estate_properties',
        'edit_published_estate_properties',
    );

    foreach ($capabilities as $cap) {
        $role->add_cap($cap);
    }
});
Technical: Child Theme

Related Articles

  • Technical How to: Child theme
  • Child Theme: How to add links to copyright message
  • How to install WpResidence child theme
  • Child Theme: How to make child theme changes to work with theme Minifiy option enabled

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 39Elementor Shortcodes Built-In
  • 46FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 24Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language - Third Party Plugins
  • 6Other Third party Plugins
  • 21Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 37Property Pages & Layouts
  • 31Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 86Theme Options & Global Settings
  • 7Translations & Languages
  • 16WPBakery Shortcodes
  • 50WPEstate / WPResidence Translate Plugin
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 9WPResidence Elementor Studio

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API