What’s your most obscure WordPress knowledge?

What’s Your Most Obscure WordPress Knowledge?

Recently, a friend reached out to ask about setting up author switching for pages, a feature that exists for posts. Several years back, I dedicated numerous hours discovering that granting the “level_1” capability to the author role enables someone to change the author of a page via the edit or quick edit screens.

Interestingly, this method still holds true today. Sharing this here for those who may find it useful.

Update: Thanks to everyone for contributing to this enlightening and fun discussion!


2 responses to “What’s your most obscure WordPress knowledge?”

  1. Certainly! The ability to change the author of a WordPress page can be a bit obscure because, by default, WordPress primarily associates author management with posts rather than pages. However, it is possible to grant certain capabilities to specific user roles, allowing them to change the authors of pages as well. Here’s a detailed explanation of how to set this up, along with additional context:

    Understanding Roles and Capabilities in WordPress

    WordPress uses a system of roles and capabilities to control what users can and cannot do. Each user role (such as Subscriber, Contributor, Author, Editor, and Administrator) comes with its own set of capabilities by default. However, WordPress is highly customizable, and these capabilities can be modified to suit your needs.

    The author Role and Pages

    By default, the author role can create and manage their own posts but not pages. However, you can extend this role’s capabilities to allow them to change the author of a page. To facilitate author switching on pages, you can grant the level_1 capability to those roles. This is a lesser-known trick but can be quite useful.

    Implementing Author Switching for Pages

    Here is a step-by-step guide on how you can allow author switching for pages:

    1. Modify User Capabilities:
      You can use a plugin like “User Role Editor” or write a custom function to alter user capabilities. Here, I’ll demonstrate how to add the level_1 capability using custom code in a plugin or a themeโ€™s functions.php file.

    2. Adding the Code:
      Add the following code to your theme’s functions.php file or create a custom plugin for cleaner management.

    “`php
    function add_custom_capability_to_author() {
    // Get the role object.
    $role = get_role( ‘author’ );

       // Check if the role exists and add capability.
       if ( $role ) {
           $role->add_cap( 'level_1' );
       }
    

    }
    add_action( ‘init’, ‘add_custom_capability_to_author’ );
    “`

    1. Check for the Capability:
      After adding the capability, authors should now be able to change the authors of pages. To do this from the edit or quick edit screens:
    2. Go to Pages > All Pages in the WordPress dashboard.
    3. Select a page and click **Edit
  2. What a fantastic tip! Author switching for pages can indeed be an overlooked feature for many WordPress users. In addition to granting the โ€˜level_1โ€™ capability, I’ve found that utilizing a custom function via hooks can also streamline this process. For instance, implementing a custom user role management plugin allows site administrators to fine-tune capabilities and even create specific roles with unique privileges tailored to their needs.

    Moreover, if you’re managing a site with multiple authors, using custom fields to link pages with specific authors can provide additional context. Itโ€™s fascinating how the flexibility of WordPress encourages us to explore its depths! What other hidden gems have you all discovered that enhance functionality or user experience?

Leave a Reply

Your email address will not be published. Required fields are marked *