When I save a page on my site, it defaults to being a draft page

Hi There,
I use Pro Sites to run my multisite network. Recently I added page/post quotas for my packages, I have 3 levels:
FREE - limited to 1 page
LITE - limited to 1 page
PRO - no limits
I set this up using the Page/Posts quota module in prosites. I have noticed though that on both the FREE & LITE packages, whenever I save my page, it defaults to being a draft (even though it's the only page on the site). Do you think you could take a look at this for me and help me figure out what is going wrong?
Thanks

  • Sajid

    Hi @sam69,
    Hope you are doing good today :slight_smile:

    Do you using limit publishing module as well ? If yes then disable that module and then check again.

    If the issue is still there then please grant support staff access so I can take a closer look. To grant access go to WPMU DEV > Support > Support Access > Grant Access or see this manual.

    Take care and have a nice day :slight_smile:
    Cheers, Sajid

      • Panos

        Hey there @sam69,

        I just had a look at your page and Post/Pages Quota seems to be working as expected. I created a new sub-site "WPMU Test" and created one page which was published as you can see in following screenshot:

        When I create a new page and publish it, it's post_status will be draft as the limit has been already set to 1 page for this level in your Post/Page Quota Settings:

        So I didn't find anything wrong going on, am I missing something here?

        Looking forward to your reply!

        Kind regards,
        Panos

          • Panos

            Hey there Samuel,

            After having a closer look I'll tell you what I've noticed in your installation. From the pages management (Admin > Pages) everything works as expected, that issue arises only when saving from the Customize page. Something is forcing the page to be saved as a draft even if that is the only page and its previous status was published.

            So I wanted to try and see if this happens in my testing installations. Unfortunately I couldn't replicate this from my customizer. I believe that you are using the Layers theme which use and interfere with it. So it could be a conflict with the Layers theme or some plugin.

            You can also try replicate this in a vanilla installation (default Twenty Sixteen theme and no other plugins) and save/publish page through the customizer and check if the same issue happens.

            Please let us know if you continue searching on it what did you notice in a vanilla installation or if you run a theme and plugin conflict check (by switching to default theme and disabling all other plugins).

            Kind regards,
            Panos

          • Samuel

            Thanks for this Panos,
            I agree with your findings that this does appear to be an issue caused by Layers regarding saving a page from the Customizer.

            Having said that, I'm at a bit of a loss for a solution to fix this - I have 50+ paid sites on my network, all of them using Layers - so changing the theme is not an option, and I also offer Free plans which make use of the page quota function in pro sites. At the minute, I have hacked together a solution that hides all "Add New" buttons in the dashboard when a user is on a free level - however, what my solution doesn't handle is making pages that exceed the quota draft if a user downgrades their site - this is absolutely key for me to resolve now as I want to start offering a free trial on my premium prosite level.

            I have disabled post revisions in my wp-config.php file, but that hasn't worked. I've also put in a support reuqest with Layers and am waiting on a response.

            Any thoughts as to how I could solve this from Por Sites end?

  • Panos

    Hello Samuel ,

    Apologies for such a late response... I had been looking into this, some times, without any success. I have though an idea that I am not sure that would work. We could hook on the action after wp has created the new blog ( wpmu_new_blog ) and turn any post created into "draft" or delete it. This way the page saved from Layers would by published. A possible code to use would look like:

    add_action( 'wpmu_new_blog', 'wpmudev_new_site_set_all_to_drafts', 10, 2 );
    
    function wpmudev_new_site_set_all_to_drafts( $blog_id, $user_id ){
      global $wpdb;
      $current_blog = get_current_blog_id();
      switch_to_blog( $blog_id );
    
      $defaultPage = get_page_by_title( 'Sample Page' );
    
      wp_delete_post( $defaultPage->ID );
    
      restore_current_blog();
    
    }

    Haven't tested it but it is possible to work.

    Kind regards,
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.