• Resolved EngageWeb

    (@stuckon_dev)


    I am looking to change defaults that are not inluded in the “change WP defaults”.
    Namely, when a new site is added to the multisite installation I would need the sample page to be removed, and 2 pages inserted by default. Lets call them “Home” and “about”. I am aware this can be done by editing Upgrade.php but that does not update proof it, meaning the next wordpress update will likely overwrite it.

    The second default I would like to change is to set the newly created “home” page as the static default homepage of that site.

    Preferably looking for solutions that can be done via functions.php and not editing core wordpress files that will be overwritten or updated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thread Starter EngageWeb

    (@stuckon_dev)

    No, that does not have the required functions I specified.

    I dont believe there is a plugin to achieve what I am looking for so its likely a scripted route of functions.php may be the way to go, I know it was mentioned somewhere that the static homepage setting is achievable through functions and I would assume that there is a hook to tie in to when the new blog is created to remove/replace the sample page with 2 others.

    Thread Starter EngageWeb

    (@stuckon_dev)

    solved.
    after huge amounts of tinkering and research. added this to my functions.php

    function my_default_pages($blog_id, $user_id){
       switch_to_blog($blog_id);
                $my_post = array();
                $my_post['post_title'] = 'New Default Page';
                $my_post['post_content'] = 'This is my page.';
                $my_post['post_status'] = 'publish';
                $my_post['post_type'] = 'page';
                $result = wp_insert_post( $my_post );
    
    update_option( 'page_on_front', $result );
    update_option( 'show_on_front', 'page' );
     restore_current_blog();
     }
    add_action('wpmu_new_blog', 'my_default_pages', 100, 2 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default settings beyond known plugins capabilities’ is closed to new replies.