wp_random_content_flush_rewrite_rules_for_post


wp_random_content_flush_rewrite_rules_for_post ( $post_id, $post = null, $update = false, $post_before = null )

Parameters:
  • (int) post_id Post ID.
  • (WP_Post|null) post Optional. Post object. Looked up from `$post_id` when null. Default null.
  • (bool) update Optional. Whether this is an existing post being updated. Default false.
  • (WP_Post|null) post_before Optional. Post object before the update, null for new posts. Default null.
See:
  • WP_Rewrite::random_rewrite_rules()
Defined at:

Description

Flushes the rewrite rules when a page or post at the random content base changes.A published page at the random base, for example `example.com/random/`, takes precedence over random content redirects. So does a published post when the permalink structure places posts at the same URL, for example `/%postname%/`, see {@see \WP_Rewrite::post_permalinks_share_random_base()}. As the rewrite rules account for the page or post, they need to be regenerated when it is published, unpublished, renamed, moved or deleted. Runs on the {@see 'wp_after_insert_post'} and {@see 'after_delete_post'} actions. Third-party code may fire these actions with unexpected values, so the parameters are not type declared. When `$post` is omitted it is looked up from `$post_id`. Passing anything other than a `WP_Post` as `$post`, or a post that cannot be looked up, is incorrect usage and nothing is flushed. `$post_before` is only considered on `wp_after_insert_post`, where passing anything other than a `WP_Post` or null is incorrect usage and the value is ignored.

Related Functions

wp_random_content_pre_get_posts, wp_random_content_redirect, wp_flush_rewrite_rules_on_site_language_change, wp_random_content_post_limits, flush_rewrite_rules

Top Google Results

User discussions

wpseek mobile