/** * Installs the blog * * {@internal Missing Long Description}} * * @since 2.1.0 * * @param string $blog_title Blog title. * @param string $user_name User's username. * @param string $user_email User's email. * @param bool $public Whether blog is public. * @param string $deprecated Optional. Not used. * @param string $user_password Optional. User's chosen password. Will default to a random password. * @param string $language Optional. Language chosen. * @return array Array keys 'url', 'user_id', 'password', 'password_message'. */ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '') { if (!empty($deprecated)) { _deprecated_argument(__FUNCTION__, '2.6'); } wp_check_mysql_version(); wp_cache_flush(); make_db_current_silent(); populate_options(); populate_roles(); update_option('blogname', $blog_title); update_option('admin_email', $user_email); update_option('blog_public', $public); if ($language) { update_option('WPLANG', $language); } $guessurl = wp_guess_url(); update_option('siteurl', $guessurl); // If not a public blog, don't ping. if (!$public) { update_option('default_pingback_flag', 0); } /* * Create default user. If the user already exists, the user tables are * being shared among blogs. Just set the role in that case. */ $user_id = username_exists($user_name); $user_password = trim($user_password); $email_password = false; if (!$user_id && empty($user_password)) { $user_password = wp_generate_password(12, false); $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.'); $user_id = wp_create_user($user_name, $user_password, $user_email); update_user_option($user_id, 'default_password_nag', true, true); $email_password = true; } else { if (!$user_id) { // Password has been provided $message = '<em>' . __('Your chosen password.') . '</em>'; $user_id = wp_create_user($user_name, $user_password, $user_email); } else { $message = __('User already exists. Password inherited.'); } } $user = new WP_User($user_id); $user->set_role('administrator'); wp_install_defaults($user_id); flush_rewrite_rules(); wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.')); wp_cache_flush(); /** * Fires after a site is fully installed. * * @since 3.9.0 * * @param WP_User $user The site owner. */ do_action('wp_install', $user); return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message); }
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(); }
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; }
/** * 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(); } }
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 }
/** * 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(); }
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'); } }
protected function _deactivate($networkwide) { // FIXME don't flush rewrite rules at network deactivation. See #32471 if (!$networkwide) { flush_rewrite_rules(); } }
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(); } }
/** * 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(); }
function zerif_flush() { if (!get_option('zerif_flush_rewrite_rules_flag')) { flush_rewrite_rules(); add_option('zerif_flush_rewrite_rules_flag', true); } }
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(); }
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(); }
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(); }
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(); }
public function flush_rewrites() { //defines the post type so the rules can be flushed. $this->register_pins(); //and flush the rules. flush_rewrite_rules(); }
/** * Perform database upgrades for version 1.3 * * @access private * @since 1.3 */ private function v13_upgrades() { @affiliate_wp()->creatives->create_table(); // Clear rewrite rules flush_rewrite_rules(); $this->upgraded = true; }
function fac_sliders_init() { $labels = array('name' => __('Sliders', 'fac'), 'singular_name' => __('Slider', 'fac'), 'add_new' => __('Add New', 'fac'), 'add_new_item' => __('Add New Slider', 'fac'), 'edit_item' => __('Edit Slider', 'fac'), 'new_item' => __('New Slider', 'fac'), 'all_items' => __('Sliders', 'fac'), 'view_item' => __('View Slider', 'fac'), 'search_items' => __('Search Slider', 'fac'), 'not_found' => __('No Sliders Found', 'fac'), 'not_found_in_trash' => __('No Sliders Found in Trash', 'fac'), 'parent_item_colon' => '', 'menu_name' => __('Slider', 'fac')); $args = array('labels' => $labels, 'public' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => 'fac', 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => array('slug' => _x('fac-sliders', 'URL slug'), 'with_front' => false), 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => false, 'menu_position' => 3, 'supports' => array('title')); register_post_type('fac-sliders', $args); flush_rewrite_rules(); }
function be_create_kudos_cpt() { $labels = array('name' => _x('Kudos', 'post type general name', 'be-kudos'), 'singular_name' => _x('Kudos', 'post type singular name', 'be-kudos'), 'menu_name' => _x('Kudos', 'admin menu', 'be-kudos'), 'name_admin_bar' => _x('Kudos', 'add new on admin bar', 'be-kudos'), 'add_new' => _x('Add New', 'kudo', 'be-kudos'), 'add_new_item' => __('Add New Kudos', 'be-kudos'), 'new_item' => __('New Kudos', 'be-kudos'), 'edit_item' => __('Edit Kudos', 'be-kudos'), 'view_item' => __('View Kudos', 'be-kudos'), 'all_items' => __('All Kudos', 'be-kudos'), 'search_items' => __('Search Kudos', 'be-kudos'), 'parent_item_colon' => __('Parent Kudos:', 'be-kudos'), 'not_found' => __('No kudos found.', 'be-kudos'), 'not_found_in_trash' => __('No kudos found in Trash.', 'be-kudos')); $args = array('labels' => $labels, 'description' => __('Description.', 'be-kudos'), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'query_var' => true, 'rewrite' => array('slug' => 'kudos'), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 5, 'menu_icon' => 'dashicons-heart', 'can_export' => true, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt')); register_post_type('kudos', $args); flush_rewrite_rules(); }
function vansSkateboarding_install() { // Trigger our function that registers the custom post type vansSkateboarding_setup_post_types(); // Clear the permalinks after the post type has been registered flush_rewrite_rules(); }
function register_taxonomy_room_types() { $labels = array('name' => _x('Room types', 'room_types'), 'singular_name' => _x('Room type', 'room_types'), 'search_items' => _x('Search Room types', 'room_types'), 'all_items' => _x('All Room types', 'room_types'), 'parent_item' => _x('Parent Room type', 'room_types'), 'parent_item_colon' => _x('Parent Room type:', 'room_types'), 'edit_item' => _x('Edit Room type', 'room_types'), 'update_item' => _x('Update Room type', 'room_types'), 'add_new_item' => _x('Add New Room type', 'room_types'), 'new_item_name' => _x('New Room type', 'room_types'), 'add_or_remove_items' => _x('Add or remove Room types', 'room_types'), 'menu_name' => _x('Room types', 'room_types')); $args = array('labels' => $labels, 'public' => true, 'show_in_nav_menus' => false, 'show_ui' => true, 'show_tagcloud' => false, 'show_admin_column' => true, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('room_types', array('room'), $args); flush_rewrite_rules(); }
/** * Called on activation. Calls necessary methods, and adds * a flag in the database that ATCF has been installed. * * @since Astoundify Crowdfunding 1.6 * * @return void */ public static function init() { flush_rewrite_rules(); update_option('atcf_installed', true); self::roles(); self::cron(); }
function activate() { // add the business member user role add_role(DBD_ROLE_NAME, DBD_ROLE_DISPLAY_NAME, array('edit_posts' => true, 'edit_published_posts' => true, 'read' => true, 'upload_files' => true, 'edit_dbd_post' => true, 'read_dbd_post' => true, 'delete_dbd_post' => true, 'edit_dbd_posts' => true, 'edit_others_dbd_posts' => true, 'publish_dbd_posts' => true, 'read_private_dbd_posts' => true)); // add roles to administrator $admin_role = get_role('administrator'); $admin_role->add_cap('edit_dbd_post'); $admin_role->add_cap('read_dbd_post'); $admin_role->add_cap('delete_dbd_post'); $admin_role->add_cap('edit_dbd_posts'); $admin_role->add_cap('edit_others_dbd_posts'); $admin_role->add_cap('publish_dbd_posts'); $admin_role->add_cap('read_private_dbd_posts'); // add roles to editor $editor_role = get_role('editor'); $editor_role->add_cap('edit_dbd_post'); $editor_role->add_cap('read_dbd_post'); $editor_role->add_cap('delete_dbd_post'); $editor_role->add_cap('edit_dbd_posts'); $editor_role->add_cap('edit_others_dbd_posts'); $editor_role->add_cap('publish_dbd_posts'); $editor_role->add_cap('read_private_dbd_posts'); // flush the rewrite rules flush_rewrite_rules(); }
function sponsor_register() { $labels = array('name' => _x('Sponsor', 'post type general name'), 'singular_name' => _x('Sponsors', 'post type singular name'), 'add_new' => _x('Add New', '"Sponsor" item'), 'add_new_item' => __('Add "Sponsor" Item'), 'edit_item' => __('Edit "Sponsor" Item'), 'new_item' => __('New "Sponsor" Item'), 'view_item' => __('View "Sponsor" Item'), 'search_items' => __('Search "Sponsor"'), 'not_found' => __('Nothing found'), 'not_found_in_trash' => __('Nothing found in Trash'), 'parent_item_colon' => ''); $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'sponsor', 'with_front' => false), 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail', 'comments')); register_post_type('sponsor', $args); flush_rewrite_rules(); }
function de_slider_register() { $labels = array('name' => _x("Slider (Home)", "post type general name", 'designesia'), 'singular_name' => _x("Slider Item", "post type singular name", 'designesia'), 'add_new' => _x("Add New", "Slider item", 'designesia'), 'add_new_item' => __("Add New Slider Item", 'designesia'), 'edit_item' => __("Edit Slider Item", 'designesia'), 'new_item' => __("New Slider Item", 'designesia'), 'view_item' => __("View Slider Item", 'designesia'), 'search_items' => __("Search Slider", 'designesia'), 'not_found' => __("Nothing found", 'designesia'), 'not_found_in_trash' => __("Nothing found in Trash", 'designesia'), 'parent_item_colon' => ''); $args = array('labels' => $labels, 'public' => true, 'menu_position' => 25, 'publicly_queryable' => true, 'exclude_from_search' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'editor')); register_post_type('slider', $args); flush_rewrite_rules(); }
function smooththemes_save_option_action() { $st_default_lang_code = get_bloginfo('language'); // DO NOT REMOVE if (isset($_POST['save']) && $_POST['save'] == 'Y') { $data = array(); foreach ($_POST as $key => $arr) { if (strpos($key, ST_SETTINGS_OPTION) !== false) { $k = str_replace(ST_SETTINGS_OPTION . '_', '', $key); $data[$k] = $arr; } } if (st_is_wpml()) { // ICL_LANGUAGE_CODE // echo var_dump($st_default_lang_code,ICL_LANGUAGE_CODE); if ($st_default_lang_code == ICL_LANGUAGE_CODE || ICL_LANGUAGE_CODE == '' || strpos($st_default_lang_code, ICL_LANGUAGE_CODE) !== false) { // update_option(ST_FRAMEWORK_SETTINGS_OPTION,$_POST[ST_FRAMEWORK_SETTINGS_OPTION]); update_option(ST_SETTINGS_OPTION, $data); } update_option(ST_SETTINGS_OPTION . '_' . ICL_LANGUAGE_CODE, $data); do_action('st_save_options', $data); } else { echo ST_SETTINGS_OPTION; update_option(ST_SETTINGS_OPTION, $data); do_action('st_save_options', $data); } flush_rewrite_rules(); } echo 1; die; }
/** * * dequeue flush rules * @since 0.9 * */ public static function dequeue_flush_rules() { if (get_option('queue_flush_rules')) { flush_rewrite_rules(); update_option('queue_flush_rules', 0); } }
function affiliate_wp_install() { // Create affiliate caps $roles = new Affiliate_WP_Capabilities(); $roles->add_caps(); $affiliate_wp_install = new stdClass(); $affiliate_wp_install->affiliates = new Affiliate_WP_DB_Affiliates(); $affiliate_wp_install->affiliate_meta = new Affiliate_WP_Affiliate_Meta_DB(); $affiliate_wp_install->referrals = new Affiliate_WP_Referrals_DB(); $affiliate_wp_install->visits = new Affiliate_WP_Visits_DB(); $affiliate_wp_install->creatives = new Affiliate_WP_Creatives_DB(); $affiliate_wp_install->settings = new Affiliate_WP_Settings(); $affiliate_wp_install->affiliates->create_table(); $affiliate_wp_install->affiliate_meta->create_table(); $affiliate_wp_install->referrals->create_table(); $affiliate_wp_install->visits->create_table(); $affiliate_wp_install->creatives->create_table(); if (!get_option('affwp_is_installed')) { $affiliate_area = wp_insert_post(array('post_title' => __('Affiliate Area', 'affiliate-wp'), 'post_content' => '[affiliate_area]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed')); $options = $affiliate_wp_install->settings->get_all(); $options['affiliates_page'] = $affiliate_area; update_option('affwp_settings', $options); } update_option('affwp_is_installed', '1'); update_option('affwp_version', AFFILIATEWP_VERSION); // Clear rewrite rules flush_rewrite_rules(); // Bail if activating from network, or bulk if (is_network_admin() || isset($_GET['activate-multi'])) { return; } // Add the transient to redirect set_transient('_affwp_activation_redirect', true, 30); }
public function __construct() { $this->register_post_type(); $this->taxonomies(); $this->meta_box(); flush_rewrite_rules(); }
/** * If the flush option is set, flush the rewrite rules. * * @since 1.2.8 */ function flush() { if (get_option('wpseo_flush_rewrite')) { flush_rewrite_rules(); delete_option('wpseo_flush_rewrite'); } }