WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 15 months ago

#43284 new defect (bug)

Drop-in: Disabling "wp_install_defaults" affect permalinks & "/login" redirect

Reported by: rajitrazaki Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.4
Component: Upgrade/Install Keywords: close
Focuses: Cc:
PR Number:

Description

I want to prevent default "Uncategorized" category, first post (Hello world!), first page, and default widgets.

I need to disable wp_install_defaults. So, I created Drop-in /wp-content/install.php which contains:

<?php
        function wp_install_defaults() {
        }
?>

Strangely it also disable default permalinks setting (it not select "Day and name" but "Plain" instead), even though permalinks is on different function wp_install_maybe_enable_pretty_permalinks.

It also not redirect /login/ to /wp-login.php.

Change History (2)

#1 @SergeyBiryukov
20 months ago

  • Component changed from General to Upgrade/Install

#2 in reply to: ↑ description @SergeyBiryukov
15 months ago

  • Keywords close added

Hi @rajitrazaki, welcome to WordPress Trac! Thanks for the report, sorry it took a while for someone to get back to you.

Strangely it also disable default permalinks setting (it not select "Day and name" but "Plain" instead), even though permalinks is on different function wp_install_maybe_enable_pretty_permalinks.

That's because wp_install_maybe_enable_pretty_permalinks() checks if the 'hello-world' post is available, and then submits a request to check if it could be loaded successfully. Otherwise, it assumes that the server does not support pretty permalinks.

I don't see a core issue here. If your server does support pretty permalinks, you can just set the desired structure manually in your wp_install_defaults() function:

update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );

It also not redirect /login/ to /wp-login.php.

This redirect depends on pretty permalinks being enabled.

Note: See TracTickets for help on using tickets.