I have a role that allows users to self publish pages but does not allow them to delete or edit after. Currently, when a page is published it returns the restricted 'Cheating' message as the user cannot view the page in edit view.

Please can someone tell me how it is possible for the publish action to redirect the user back to the page list rather than the edit view?

Many thanks


I have the below code which works as expected if anyone else is looking for similar.

add_action( 'publish_page', 'redirect_user_page_list', 10, 3 );
function redirect_user_page_list() {
if( is_user_logged_in() ) {
    $user = wp_get_current_user();
    $role = ( array ) $user->roles;
        if ( 'role_slug' == $role[0] ) {
            $url = 'url to redirect to';
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.