• Resolved mariogroleau

    (@mariogroleau)


    How to assign or change role to multiple pages or posts in one shot?

    It is a long and tedious task to change roles to access a large number of posts and pages. Each element must be changed one by one. Do you have a solution to make the change in batch? Could this be done by adding the roles to the quick edit menu? Thus, having selected all the pages and articles concerned, it would be possible to make the change in batch!

    Best regards

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

    (@caseproof)

    Hi @mariogroleau

    Here is the code that you can run to protect multiple posts at once for one of the roles:

    $postIds = array(12, 35, 254, 265);
    foreach ($postIds as $postId) {
    	add_post_meta( $postId, '_members_access_role', 'administrator', true );
    }

    In this example I protected posts with IDs: 12, 35, 254, and 265 so only Administrator has access to these posts.

    I hope that helps.

    Thread Starter mariogroleau

    (@mariogroleau)

    Hello,

    Thank you, but I was mainly thinking of a function added to the list of posts or pages that we could use by checking those whose roles we want to change and make the change via Bulk actions / Edit.

    This is a suggestion for a new function

    Best regards

    • This reply was modified 1 year, 6 months ago by mariogroleau.
    Plugin Author Caseproof

    (@caseproof)

    I’ll pass this on to our team review. Thank you for pointing this out. We appreciate it.

    Best

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to assign or change role to multiple pages or posts’ is closed to new replies.