Tag Info

New answers tagged

0

Isn't what you are trying to achieve the point of the rewrite slug? e.g. if you have a news category as press and another as event then simply changing register_taxonomy('news_category', 'stfp_news', array( 'hierarchical' => true, 'show_admin_column' => true, 'label' => __('Categories'), 'show_ui' => true, 'query_var' => false, 'rewrite' ...


0

I would use the wp hook, which fires right after the request has been parsed and queried: function wpse_199869_wp( $wp ) { if ( ! is_admin() && is_404() && preg_match( '/^bh-job/', $wp->request ) ) { wp_redirect( home_url( user_trailingslashit( 'jobs' ) ) ); exit; } } add_action( 'wp', 'wpse_199869_wp' ); We ...


-1

This is the filter I'm using: function em_wpml_dbem_taxonomy_category_slug($option){ $lang = get_bloginfo('language'); if( $lang === 'es-ES' ){ $option = 'eventos/categorias'; } else { $option = 'events/categories'; } return $option; } add_filter('pre_option_dbem_taxonomy_category_slug', 'em_wpml_dbem_taxonomy_category_slug');


0

Not sure what exactly you want. Can you please elaborate your question a bit more? If you want URLs like www.mysite.com/subfolder/postname (where the subfolder is where your WordPress install is), then just go to Settings > Permalinks and change it to Post Name. EDIT If your WordPress install is in subfolder and you want URLs like ...


0

So the problem was redirect_guess_404_permalink was detecting a 404 error and 'guessed' /members/blog to be /blog My hacky solution was to hook into the status error check (Stop Wordpress from "guessing" redirects for nonexistent URLs) and if URL parts match then unset the guessed solution function blog_no_redirect_guess_404_permalink( $header ){ ...


1

This is by design and intentional. WordPress rewrites have become increasingly complex over the years, and many plugins utilise the page endpoint for a page (usually with a template and custom query) - redirecting introduces a potential world of pain. Long story short, it doesn't matter anyway. WordPress adds <link rel="canonical /> for pages, so no ...


1

WordPress as a content management system organizes pieces of data into categorizations. It calls any individual piece of data that it might manipulate or display a "post", and any way to classify or organize that piece of data a "taxonomy". But not every post is the same, and there are often groups of posts that have a distinct set of properties that are ...


1

You can set the rewrite slug when you register your post type: $args = array( 'rewrite' => array( 'slug' => 'media/lajmet' ) // other args... );


0

You can do it, but it's not straightforward. When you register a custom post type in WordPress, the first argument of register_post_type is the slug that you use. This slug can only be for one URL segment. If you changed it to media then all of your articles would take the form /media/article-slug-here. If you want to nest it deeper, you will have to ...


1

Personally I would not recommend breaking the taxonomy archives - what if someone wants to browse all posts tagged "ferrari"? You're better off using the page URL in the first place: if ( $tags = get_the_terms( $post, 'vehicle' ) ) { foreach ( $tags as $tag ) { if ( $_page = get_page_by_path( "cars/$tag->slug" ) ) printf( '<a ...


1

It is excruciatingly painful to deeply customize WordPress load process. It's not quite clear if your requirements here are performance related or tied to soemthing else. For your question as stated there would be about following approaches (madness ascending): get rid of actual code causing unwanted queries, altogether or via techniques like caching ...


1

It's generally consider pretty bad practice to have the same content at different URLs on a site and will probably damage your search engine performance. Bear in mind you'll likely need to use a rel="canonical" link tag in your page header pointing to one of the three possible URLs. Also Wordpress stores many links directly in its database and these also ...


0

I used the following functions to solve this problem. //This adds a custom query variable to the permalink function add_custom_query_var( $vars ){ $vars[] = "shop_name"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); function add_rewrite_rules($aRules) { $aNewRules = array('shop/([^/]+)/?$' => ...


0

You can add this in your functions.php: global $wp_rewrite; $wp_rewrite->author_base = "member"; // or whatever $wp_rewrite->flush_rules();


0

10up engineering best practices as a great example on how to achieve that. You basically add a new rewrite tag and a new rewrite rule and then using the template_redirect action you return your custom action. Here is the code: add_action( 'init', function() { add_rewrite_tag( '%model%', '([^/]+)' ); add_rewrite_rule( 'cars/([^/]+)/?', ...



Top 50 recent answers are included