How to make new blog owners in Multisite unable to delete a page

Hi there,

I make a pretty big intro to descibe my problem the best I can however, you can skip it and read the last line in you want to get to the core.

I'm setting up a WP Multisite where new blog owners are assigned a role of editor via the script from the author of User Role Editor.

I'm doing this to simplify as much as possible user interface.

Editors don't have access to all the settings which I fill in in the template using your New Blog Templates plugin. I also set up starting pages one of which is assigned as a front page.

In my theme's folder I have front-page.php file which gives the front page a distinct look. By using this file name I make sure that this page template isn't visible in the page template list (in page attributes) but is automatically hooked to whichever page is set as a front page.

Obviously, the page chosen as the front page can never be deleted. If it were, blog owners wouldn't be able to set a different page in their place (they can't see and access admin menu where it's done).

To ensure that they will never delete a page set as a front page I'm not giving blog owners "delete_others_pages" (or something like that) capability. This means that they can't delete the page I've created. This way, they can do with the page whatever they want except deleting it. So far so good.


Unfortunately, when a new subsite is created the authorship of all the pages get transfered to them.

And this is where I need your help.

I've found this topic on your support forum >
In it, one of your devs got the author a script that prevented images from media library from changing authors on subsite creation. What I need is the same but for the page authors. Just that.

Could you please, help me with that?

  • Ash

    Hello there

    I hope you are well today and thanks for asking the question.

    Would you please try the following code:

    add_filter( 'blog_templates-process_row', 'my_custom_set_attachments_author', 10, 1 );
    function my_custom_set_attachments_author( $row ) {
    	if ( isset( $row['post_type'] ) && $row['post_type'] == 'page' ) {
    		$row['post_author'] = 1;
    	return $row;

    This code is just another version of @Ignacio for page. Please give it a try.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.


  • Ignacio

    Hi @Krzysztof.

    I don't know if I got you exactly but New Blog Templates has an option to block the posts when they are copied to the new blog, have you tried it?

    About @Ashok answer I wanted to add that always try to add the code using a plugin (in mu-plugins folder or plugins and activating it). The problem with the theme is that when you switch your theme you'll loose those changes and also, in a network you need to make sure that it will work in every subsite. Not a problem for NBT in this case as it only works in the main blog but try to follow those guidelines, it will make your life easier.


  • Krzysztof

    Hi Ignacio. Thank you for the advice.

    I know about pag/post locking but this is not good for me since I want to let users update the page however they want. I just don't want to let them delete it.

    Thank you for you help guys. I need to tell you however, that I've found a solution on my own (yesterday at night to be precise) without using any code snippets. I'm posting it here for anybody who's interested.


    In order to prevent subsite owners from deleting certain pages in multisite using New Blog Temapltes follow these steps:

    1. Create a simple plugin and network activate it
    2. In the plugin add lines:

    add_action( 'init', 'my_custom_init' );
    function my_custom_init() {
    remove_post_type_support( 'page', 'author' );

    This will remove the dropdown letting users change page authors

    3. Download User Role Editor plugin and network activate it
    4. In the plugin go to administrator (or whichever role your subsite owners are assigned to) and remove capability "delete pages others" (or something like that). Click "apply to all subsites" and then "update".
    5. Create a new user
    6. Assign this user to your template and make him an auhor of pages you don't want other users to delete
    7. Go to New Blog Templates settings and check "copy users"


    Now, whenever a user registers and gets a new site, they will be unable to delete pages that the X user was assigned to. They will also be unable to change the page's authorship due to the lack of the field in page edit screen and quick edit form.

    It took me a while (a longer longer while) to figure it out but it works and so far it seems to work exactly as expected.

    Have a great day guys,
    Keep up good work.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.