Permalink problems with custom post type and custom taxonomy

Question 1 Permalink structure

I trying to implement the right url/permalink structure for my site, but I can’t get it to work.

I have the following setup:

Custom post type: training

  register_post_type( 'training',
        'labels' => array(
            'name' => __( 'Trainingen' ),
            'singular_name' => __( 'Training' ),
            'all_items'           => __( 'Alle trainingen' ),
            'view_item'           => __( 'Bekijk training' ),
            'add_new_item'        => __( 'Nieuwe training' ),
            'add_new'             => __( 'Nieuwe training' )
        'public' => true,
        'has_archive' => true,
        'hierarchical' => false,
        'rewrite' => array('slug' => 'our-training', 'with_front' => false),
        'show_in_rest' => true
**Custom taxonomy : training-category**
    $args = array(
        "label" => ( "training category"),
        "labels" => $labels,
        "rewrite" => array( 'slug' => 'training-category', 'with_front' => true, ),
        "show_admin_column" => true,
        "hierarchical" => false,
        "has_archive" => true,
        "show_ui" => true
    register_taxonomy( "training_category", array( "event", "post", "training", "employee"), $args );

The permalink structure I want to establish:


what I do get is:


So the custom taxonomy is not inserted correctly in the permalink.

(I am also using Yoast breadcrumbs and have set the taxonomy to show for the training cpt to: training-category (my custom tax).)

Any tips on how I can get the desired permalink structure?

Question 2 – Redirect

Secondly I use facetwp for filtering so I need to redirect the category archive to a facetwp archive page.
Redirect I want to establish (simplyfied):


must redirect to:


How can I do this the best way?

Any pointers in the right direction will be highly appreciated!

woocommerce custom permalink with custom field gives a 404 error

good evening
I’m attempting to make custom permalinks on woocommerce products as a way of a translation in a way that i’ll have http://mysite/fr/my-product-name for french translation and http://mysite/en/my-product-name and the language variable would be a custom field within a metabox i’ve added to the product itself

function add_rewrite_rules(){
    // Register custom rewrite rules

    global $wp_rewrite;    
    $wp_rewrite->add_rewrite_tag('%field%', '((a-zA-Z)*)','field=');
    $wp_rewrite->add_permastruct('product', '/%field%/%postname%', false);


function permalinks($permalink, $post, $leavename){    
  if($post->post_type != 'product') {
    return $permalink;
  $field =  get_post_meta($post->ID, 'field', true);   
  $permalink = str_replace('/%field%', $field, $permalink);
  $permalink = str_replace('%postname%', $post->post_name, $permalink);
  return $permalink;    

add_action('init', 'add_rewrite_rules');
add_filter('post_type_link', 'permalinks', 10, 3);

enter image description here

is there a way to fix the 404 error that it gives on the product? and thank you

posts – Permalink Short code showing unnecessary link text inside the loop

Recently I need Help regarding this permalink shortcode

function my_permalink(){
return ob_get_flush();}


for this, I get a shortcode (my_permalink), it’s working fine

But the problem is when I use this shortcode on my WordPress Posts, Pages, CPT, CT or any custom Archive Page it shows me some unnecessary link text which is at top of the loop and also it does not include any HTML tag

I am showing the screenshot and the link appearing position in the posts


        <div class="entry-content">
  <div class="wprt-container"><p>KFRI Recruitment 2021 for 1 Project Assistant Applications are invited from eligible candidates for the post of one <b>Project Assistant </b>under the project KFRI/RP 823/2021 entitled “Ecological studies on post restoration success of threatened plants in situ.&#8221;</p>

The URL appears:

I just paste the shortcode:

Inside inspect Elements:

Custom RSS Feed Overwrites Permalink

I’m trying to setup a custom RSS feed for attachments with a meta field. I succeeded in making the feed, however it’s now overwriting the actual site content.

add_action( 'init', 'add_custom_feed' );
function add_custom_feed() {
  add_feed( 'photos', 'render_photos_feed');
function render_photos_feed() {
  //WP_Query for attachment
  get_template_part( 'rss', 'photos' );

I have a poor understanding of where exactly a url is created here. What I’m expecting is or I’m getting but then also, which is where the Page that displays my photos exists. I can flush permalinks and turn off the action for this feed and render my page, but when it’s online, I can see on the Photos page that its permalinked to photos-2. I can’t find any documentation online about why that happens.

I really don’t want to create a CPT for these, the workflow of adding a checkbox was really easy & reduces noise on the backend and the WP Query works. Secondarily, I also am wondering if it’s possible to change the main feed to be posts & photos. I can’t just hijack the feed WP_Query because its an OR logic (get posts or attachment w/ meta value). Any thoughts there are welcome too.

php – WordPress permalink, show a product catagory page on a normal WP page

I’m not sure if I’m having a bad brain day but I am going round in circles with something I know is so simple. As a note, I am pretty new to developing in WordPress so apologies if it genuinely is something so simple.

Essentially I am needing to have a page ( show the exact same page as the category page for gear (

Is there a way for the permalink to show the product category page without changing the permalink? Would it be better practice to use something like is_page( ‘gear’ ); and then create a partial to show category products? Or is there something so much simpler than I can look into using?

I am not wanting to change the permalinks for product_catagoy I just want a new page to show a product category page (gear).

Thanks for your help


Quick way to get permalink (with commit hash) to file in Bitbucket?

When I’m viewing a page with the source code of a certain file on the “master” or “main” branch, often I want to copy the URL of that file but at its actual commit hash so that it’s a permalink.

GitLab makes this super obvious. E.g. shows:

enter image description here

GitHub makes it possible too.

What is the fastest, most convenient way to do the same in Bitbucket?

Post name permalink doesn’t work

I changed the permalink structure of my site from default to postname, but this does not work: trying to access a post returns me the error 404.

Then I tried to try other types of permalinks, and everyone worked (except /%postname%/, of course). So I tried to create a custom permalink: /index.php/%postname%/. This works and I can not understand why.

I tried to change the theme and to set the structure postname and everything works perfectly. From what can be due to the error?

This is my .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – (L)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php (L)

I also have Module rewrite already enabled and

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Still doesn’t work, any ideea?

How to implement a different permalink structure for custom post type?

Tried to use this plugin, but it doesn’t seem to be working:

I’m setting a permalink structure for by blog posts in settings>permalinks like so: /blog/%postname%

I also have a custom post type called “project”, where I want the structure to be /our-work/%postname, but instead the /blog part gets prepended here too. How can I keep a separate permalink structure for this custom post type?

Here’s the register_post_type function:

register_post_type('project', array(
    'public' => true,
    'custom' => true,
    'show_ui' => true,
    'supports' => array('title','editor','revisions'),
    'labels' => array(
        'name' => 'Projects',
        'singular_name' => 'Project',
        'add_new_item' => 'Add New Project',
        'edit_item' => 'Edit Project'
    'menu_icon' => 'dashicons-portfolio',
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_rest' => true,
    'rewrite' => array(
        'slug' => 'our-work', 
        'with_front' => true
    'has_archive' => true,
    'show_in_graphql' => true,
    'graphql_single_name' => 'project',
    'graphql_plural_name' => 'projects',
    'cptp_permalink_structure' => '%post_id%'

WordPress permalink not working on subdomain

My WordPress permalink not working on subdomain etc :

In normally wordpress will redirect automatic like this : >

but now my website still used plain : >

How can i fix it! Thank you.

My .htaccess

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

How to achieve a custom post type permalink like this!

How to achieve a custom post type permalink like this!