本文整理汇总了PHP中flush_rewrite_rules函数的典型用法代码示例。如果您正苦于以下问题:PHP flush_rewrite_rules函数的具体用法?PHP flush_rewrite_rules怎么用?PHP flush_rewrite_rules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flush_rewrite_rules函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_debatepost_type
function create_debatepost_type()
{
$labels = array('name' => 'Debates', 'singular_name' => 'Debate', 'menu_name' => 'Debates', 'all_items' => 'All Debates', 'view_item' => 'View Debate', 'add_new' => 'Add Debate', 'parent_item_colon' => '');
$args = array('labels' => $labels, 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'rewrite' => array('slug' => 'debate'), 'menu_position' => null, 'has_archive' => true, 'publicly_queryable' => true, 'capability_type' => 'post');
register_post_type('debate', $args);
flush_rewrite_rules();
}
示例2: updater
/**
* Handle Updates
*/
public function updater()
{
if (version_compare(JOB_MANAGER_VERSION, get_option('wp_job_manager_version'), '>')) {
WP_Job_Manager_Install::install();
flush_rewrite_rules();
}
}
示例3: update_rewrite_rules
function update_rewrite_rules($value, $old_value)
{
remove_filter('pre_update_option_rewrite_rules', array($this, 'update_rewrite_rules'), 100, 2);
$this->add_endpoints();
flush_rewrite_rules();
return $value;
}
示例4: wpl_toolskit_gallery_taxomomy
/**
* Register Custom Taxonomy
*
* @since 1.0.0
*/
public function wpl_toolskit_gallery_taxomomy()
{
$labels = array('name' => _x($this->wpl_get_name_singular() . ' ' . 'Categories', 'Taxonomy General Name', 'charitylife-toolskit'), 'singular_name' => _x($this->wpl_get_name_singular() . ' ' . 'Category', 'Taxonomy Singular Name', 'charitylife-toolskit'), 'menu_name' => __($this->wpl_get_name_singular() . ' ' . 'Categories', 'charitylife-toolskit'), 'all_items' => __('All Categories', 'charitylife-toolskit'), 'parent_item' => __('Parent Category', 'charitylife-toolskit'), 'parent_item_colon' => __('Parent Category:', 'charitylife-toolskit'), 'new_item_name' => __('New Category Name', 'charitylife-toolskit'), 'add_new_item' => __('Add New Category', 'charitylife-toolskit'), 'edit_item' => __('Edit Category', 'charitylife-toolskit'), 'update_item' => __('Update Category', 'charitylife-toolskit'), 'view_item' => __('View Category', 'charitylife-toolskit'), 'separate_items_with_commas' => __('Separate items with commas', 'charitylife-toolskit'), 'add_or_remove_items' => __('Add or remove items', 'charitylife-toolskit'), 'choose_from_most_used' => __('Choose from the most used', 'charitylife-toolskit'), 'popular_items' => __('Popular Categories', 'charitylife-toolskit'), 'search_items' => __('Search Categories', 'charitylife-toolskit'), 'not_found' => __('Not Found', 'charitylife-toolskit'));
$args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'rewrite' => array('slug' => $this->wpl_get_category_url_rewrite()));
register_taxonomy('wpl_gallery_category', array('post_gallery'), $args);
flush_rewrite_rules();
}
示例5: display_clink_main_slug
function display_clink_main_slug()
{
// validate and update clink_main_slug value
$clink_main_slug_option = get_option('clink_main_slug');
if ($clink_main_slug_option) {
$clink_main_slug_option = str_replace(' ', '-', $clink_main_slug_option);
// Replaces all spaces with hyphens.
$clink_main_slug_option = preg_replace('/[^A-Za-z0-9\\-]/', '', $clink_main_slug_option);
// Removes special chars.
update_option('clink_main_slug', $value = $clink_main_slug_option);
$clink_main_slug_option = get_option('clink_main_slug');
} elseif (empty($clink_main_slug_option)) {
update_option('clink_main_slug', $value = 'clink');
$clink_main_slug_option = get_option('clink_main_slug');
}
// Flush rewrite rules after Clink settings update
if (isset($_GET['settings-updated'])) {
flush_rewrite_rules();
}
$clink_slug_structure = get_bloginfo('url') . '/' . $clink_main_slug_option . '/link-name';
?>
<input type="text" name="clink_main_slug" id="clink_main_slug" value="<?php
echo $clink_main_slug_option;
?>
" />
<p class="description clink-description"><?php
_e('Enter the clink plugin base slug for links. In default it set to <code>clink</code>', 'aryan-themes');
?>
</p>
<p class="description clink-description"><?php
printf(__('Current links structure is like: <code>%s</code>', 'aryan-themes'), $clink_slug_structure);
?>
</p>
<?php
}
示例6: _deactivate
protected function _deactivate($networkwide)
{
// FIXME don't flush rewrite rules at network deactivation. See #32471
if (!$networkwide) {
flush_rewrite_rules();
}
}
示例7: upgrade
public function upgrade($old_db_version = false)
{
global $wpdb;
//$frm_db_version is the version of the database we're moving to
$frm_db_version = FrmAppHelper::$db_version;
$old_db_version = (double) $old_db_version;
if (!$old_db_version) {
$old_db_version = get_option('frm_db_version');
}
if ($frm_db_version != $old_db_version) {
// update rewrite rules for views and other custom post types
flush_rewrite_rules();
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$this->create_tables();
$this->migrate_data($frm_db_version, $old_db_version);
/***** SAVE DB VERSION *****/
update_option('frm_db_version', $frm_db_version);
/**** ADD/UPDATE DEFAULT TEMPLATES ****/
FrmXMLController::add_default_templates();
}
do_action('frm_after_install');
/**** update the styling settings ****/
if (is_admin() && function_exists('get_filesystem_method')) {
$frm_style = new FrmStyle();
$frm_style->update('default');
}
}
示例8: book_init
/**
* Custom post type - Book
*/
function book_init()
{
$labels = array('name' => 'Books', 'singular_name' => 'Book', 'add_new' => 'Add New', 'add_new_item' => 'Add New Book', 'edit_item' => 'Edit Book', 'new_item' => 'New Book', 'view_item' => 'View Book', 'search_items' => 'Search Books', 'not_found' => 'No books found', 'not_found_in_trash' => 'No books found in Trash');
$args = array('labels' => $labels, 'description' => 'A custom post type that holds my books', 'public' => true, 'rewrite' => array('slug' => 'books'), 'has_archive' => true, 'taxonomies' => array('book_category'), 'supports' => array('title', 'editor', 'author', 'excerpt', 'custom-fields', 'thumbnail'));
register_post_type('book', $args);
flush_rewrite_rules();
}
示例9: options_page
public static function options_page()
{
$tab = self::current_tab();
?>
<div class="wrap">
<?php
self::plugin_options_tabs();
?>
<form method="post" action="options.php" class="options-form">
<?php
settings_fields($tab);
?>
<?php
do_settings_sections($tab);
?>
<?php
if (WP_REST_API_Log_Settings_Help::$settings_key !== $tab) {
submit_button(__('Save Changes'), 'primary', 'submit', true);
}
?>
</form>
</div>
<?php
$settings_updated = filter_input(INPUT_GET, 'settings-updated', FILTER_SANITIZE_STRING);
if (!empty($settings_updated)) {
do_action('wp-rest-api-log-settings-updated');
flush_rewrite_rules();
}
}
示例10: partners
function partners()
{
$labels = array('name' => _x('Partners', 'post type general name'), 'singular_name' => _x('Partners', 'post type singular name'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New Partners'), 'edit_item' => __('Edit Partners'), 'new_item' => __('New Partners'), 'all_items' => __('All Partners'), 'view_item' => __('View Partners'), 'search_items' => __('Search Partners'), 'not_found' => __('No partners found.'), 'not_found_in_trash' => __('No partners found in the Trash.'), 'parent_item_colon' => '', 'menu_name' => 'Partners');
$args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'capability_type' => 'post', 'supports' => array('title', 'editor', 'thumbnail'), 'hierarchical' => true);
register_post_type('partners', $args);
flush_rewrite_rules();
}
示例11: zerif_flush
function zerif_flush()
{
if (!get_option('zerif_flush_rewrite_rules_flag')) {
flush_rewrite_rules();
add_option('zerif_flush_rewrite_rules_flag', true);
}
}
示例12: services_post_type
function services_post_type()
{
$labels = array('name' => _x('Services', 'post type services'), 'singular_name' => _x('Service', 'post type singular services'), 'add_new' => _x('Add new service', 'services'), 'add_new_item' => __('Add new services'), 'edit_item' => __('Edit service'), 'new_item' => __('New service'), 'view_item' => __('View service'), 'search_items' => __('Search services'), 'not_found' => __('Nothing found'), 'not_found_in_trash' => __('Nothing found in Trash'), 'parent_item_colon' => '', 'menu_name' => 'Services');
$args = array('labels' => $labels, 'public' => true, 'menu_icon' => 'dashicons-menu', 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('with_front' => false, 'slug' => 'services'), 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, 'show_in_nav_menus' => true, 'supports' => array('title', 'taxonomy', 'thumbnail', 'editor', 'excerpt'));
register_post_type('services', $args);
flush_rewrite_rules();
}
示例13: post_type
public function post_type()
{
$labels = array('name' => 'Recipes', 'singular_name' => 'Recipe', 'add_new' => 'Add New', 'add_new_item' => 'Add New Recipe', 'edit_item' => 'Edit Recipe', 'new_item' => 'New Recipe', 'all_items' => 'All Recipes', 'view_item' => 'View Recipe', 'search_items' => 'Search Recipes', 'not_found' => 'No recipes found', 'not_found_in_trash' => 'No recipes found in Trash', 'parent_item_colon' => '', 'menu_name' => 'Recipes');
$args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => false, 'show_in_menu' => false, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array('tags', 'comments'));
register_post_type($this->get_post_type_name(), $args);
flush_rewrite_rules();
}
示例14: on_activation
public function on_activation()
{
# First, we add the custom post type.
$this->register();
# Reset Apache rewrites to accommodate our new post type.
flush_rewrite_rules();
}
示例15: flush_rewrites
public function flush_rewrites()
{
//defines the post type so the rules can be flushed.
$this->register_pins();
//and flush the rules.
flush_rewrite_rules();
}