AnsPress_Admin::init_actions()
Description #
Hook to run on init
Source #
File: admin/anspress-admin.php
public static function init_actions() {
$GLOBALS['wp']->add_query_var( 'post_parent' );
// Flush_rules if option updated.
if ( isset( $_GET['page'] ) && ('anspress_options' === $_GET['page']) && isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ) { // @codingStandardsIgnoreLine.
$options = ap_opt();
$page = get_page( ap_opt( 'base_page' ) );
$options['base_page_slug'] = $page->post_name;
update_option( 'anspress_opt', $options );
ap_opt( 'ap_flush', 'true' );
}
// If creating a new question then first set a question ID.
global $typenow;
global $pagenow;
if ( in_array( $pagenow, array( 'post-new.php' ), true ) &&
'answer' === $typenow &&
! isset( $_GET['post_parent'] ) // @codingStandardsIgnoreLine.
) {
wp_safe_redirect( admin_url( 'admin.php?page=ap_select_question' ) );
exit;
}
add_filter( 'pre_get_posts', array( __CLASS__, 'serach_qa_by_userid' ) );
}
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:328
Add your comment