Tag Info

Hot answers tagged

3

This approach should work for you: <?php /** * Plugin Name: Rewrite Shortcode **/ add_shortcode( 'myplugin', 'mp_shortcode' ); function mp_shortcode(){ return '<p>Filter: ' . get_query_var( 'filter' ) . '</p>'; } add_action( 'init', 'mp_rewrite' ); function mp_rewrite(){ $post_id = 2; add_rewrite_rule( ...


3

The redirect is thanks to redirect_canonical() - we can simply swoop in with a filter and disable it for the front page: function wpse_184163_disable_canonical_front_page( $redirect ) { if ( is_page() && $front_page = get_option( 'page_on_front' ) ) { if ( is_page( $front_page ) ) $redirect = false; } return ...


2

If you check out the output() method in the includes/admin/class-wp-job-manager-setup.php file, namely this part: /** * Output addons page */ public function output() { $step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; if ( 3 === $step && ! empty( $_POST ) ) { $create_pages = isset( ...


1

See flush_rules in Codex: Because this function can be extremely costly in terms of performance, it should be used as sparingly as possible - such as during activation or deactivation of plugins or themes. Every attempt should be made to avoid using it in hooks that execute on each page load, such as init. Only flush rules when they change, not on ...


1

I would use the add_rewrite_rule() function, please note that the code is untested but it should work depending on your specific use. If you also need to set a post_id, just add it to the index.php?p=X... string. function myplugin_filter_add_rewrite_rules() { // Allow for /myplugin/filter/someFilter add_rewrite_rule('myplugin/filter/([^/]+)/?$', ...


1

You can just look at url, load the file and exit. That can be done when WordPress loaded its environment, e.g. on 'init'. add_action('init', function() { $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/'); if ( $url_path === 'retail' ) { // load the file if exists $load = locate_template('template-retail.php', true); ...


1

a multi site approach wouldn't work since you will be creating multiple blogs, each will work as an individual WP installation, so each of them will hold multiple posts, pages, categories, etc that are not shared between blogs. The url you are proposing can't be defined using wordpress routing, so a custom code will need to be developed for this approach.



Only top voted, non community-wiki answers of a minimum length are eligible