You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The after_setup_theme action is called on every page load, so it's not the best way to enable pretty permalinks and flush rewrite rules (which is considered an "expensive" operation).
A better way is to do it once using the runPHP step.
{
"step": "runPHP",
"code": "<?php include '/var/www/html/wp-load.php'; global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules();"
},
There might be a simpler way to achieve it. This PR seems to have made pretty permalinks the default.
Making a note of something I noticed in the documentation.
The example for the blueprint step
writeFile
shows how to create amu-plugin
that enables pretty permalinks.Expanding the code:
The
after_setup_theme
action is called on every page load, so it's not the best way to enable pretty permalinks and flush rewrite rules (which is considered an "expensive" operation).A better way is to do it once using the
runPHP
step.There might be a simpler way to achieve it. This PR seems to have made pretty permalinks the default.
This method does not flush rewrite rules. Maybe it's not needed because it's always run on a freshly created site.
Anyway, if the default is to use pretty permalinks, then the above mentioned example in the docs is unnecessary and could be removed altogether.
The text was updated successfully, but these errors were encountered: