Skip to content

Discontinue use of register_activation_hook() to flush rewrite rules (on multisite) #801

@westonruter

Description

@westonruter

Currently the rewrite rules get flushed at the register_activation_hook(). This works fine for single-site installs. However, it does not work on multisite. For multisite users, they then have to hit the permalinks admin screen for every site in order to flush the rewrite rules. For large networks, this is not feasible. So the plugin should probably do more dynamic checking at runtime if all the rewrite rules are present, and if not, flush them for a given site. This could avoid having to flush rewrite rules after adding support for a custom post type as well.

For more, see https://jeremyfelt.com/2015/07/17/flushing-rewrite-rules-in-wordpress-multisite-for-fun-and-profit/

Aside: When adding support for pages (#176), the AMP version will probably require using the query param /?amp instead of the path /amp/ endpoint, for the sake of the page rewrite rules. Since AMP cache does not reveal the full URL anyway, having pretty permalinks is somewhat pointless. We couldn't just remove the endpoint, however, without additional work to fix 404s to redirect from /amp/ to /?amp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions