• Resolved emilyb6116

    (@emilyb6116)


    I have about 2,000 pages that I need to enable role restrictions for. Is there a way to do this without opening up each item and checking the appropriate role?

    Having an option in the bulk editor would be nice.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Caseproof LLC

    (@caseproof)

    Hi @emilyb6116

    We don’t have bulk content permission feature, so the best way to protect multiple pages at once would be to run the code snippet below and replace page IDs:

    $pages = array(1297, 14);
    foreach($pages as $page) {
      update_post_meta($page, '_members_access_role', 'administrator');
    }

    I protected two pages in this code but you can add more pages or use more advanced code to pull specific pages from the database.

    I hope that helps.

    Thread Starter emilyb6116

    (@emilyb6116)

    Great, thank you!

    Will this add the specified role to whatever is there, or replace the role all together if there is one already in place?

    Plugin Author Caseproof LLC

    (@caseproof)

    This will update role for pages from the array if they exist, and add new one if it does not exist.

    Best

    Thread Starter emilyb6116

    (@emilyb6116)

    That worked. Thank you! I had to end up changing update_post_meta to add_post_meta to get it to keep the existing permissions and add the additional one.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Bulk Update Page Restrictions’ is closed to new replies.