AnsPress_Hooks::base_page_update( integer $post_id, object $post )
Description #
Flush rewrite rule if base page is updated.
Parameters #
- $post_idinteger (Required) Base page ID.
- $postobject (Required) Post object.
Source #
File: includes/hooks.php
public static function base_page_update( $post_id, $post ) {
if ( wp_is_post_revision( $post ) ) {
return;
}
$main_pages = array_keys( ap_main_pages() );
$page_ids = [];
foreach ( $main_pages as $slug ) {
$page_ids[ ap_opt( $slug ) ] = $slug;
}
if ( in_array( $post_id, array_keys( $page_ids ) ) ) {
$current_opt = $page_ids[ $post_id ];
ap_opt( $current_opt, $post_id );
ap_opt( $current_opt . '_id', $post->post_name );
ap_opt( 'ap_flush', 'true' );
}
}
Expand full source code Collapse full source code View on GitHub: includes/hooks.php:626
Add your comment