how to flush custom author rewrite rule
Just use flush_rewrite_rules(); Documentation here.
Just use flush_rewrite_rules(); Documentation here.
SOLUTION For my case i only had to add this code to my taxonomy: ‘rewrite’ => array( ‘slug’ => ‘mypostype-wich-should-be-displayed-before-the-taxonomy’, // This controls the base slug that will display before each term ‘with_front’ => false // Don’t display the category base before )
you don’t want the link to the actual post then use the field link again: <?php $args = array( ‘numberposts’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘include’ => ”, ‘exclude’ => ”, ‘meta_key’ => ”, ‘meta_value’ =>”, ‘post_type’ => ‘weekly_mktg_report’, ‘post_status’ => ‘publish’ ); $recent_posts = wp_get_recent_posts( $args ); echo ‘<ul>’; //i was … Read more
I was thinking too ‘difficult’. Instead of rebuilding a new permalink structure I could have easily updated the new permalink the way I want to have it. So I deleted the entire rewrite part and changed the query in acf/save_post to the following: if ( ! empty( $_POST[ ‘acf’ ][ $ad_title ] ) ) { … Read more
TL:DR: The slug of the home page and a folder at the root had the same name There was a folder that I was using for home page assets, the address was “example.net/home/” and the original WP development was “example.net/wordpress/”. When I moved the wordpress files out to the root, the home page had a … Read more
You can use get_sample_permalink() Call get_sample_permalink( $id ) or if you want to pass your own title or slug into it, the full signature is get_sample_permalink( $id, $title = null, $name = null)
You can achieve the following permalink structure by simply overriding (without having to remove) the default one (you specified) for the resources post type: /resources/%resources%/resources-type/%resources_type% <- preferred /resources/resources-type/%resources_type%/%resources% <- default And you can override it via add_permastruct() — first, register the post type without specifying the rewrite parameter which means the rewrite defaults to true/enabled … Read more
The second argument of wp_unique_post_slug filter is post id. You can utilize that to generate the slug only once while creating the post for the first time. Method 1: add_filter( ‘wp_unique_post_slug’, ‘unique_slug_108286’, 10, 2 ); function unique_slug_108286( $slug, $postId ) { if ( ! $postId ) { $n = 4; $slug = bin2hex( random_bytes( $n … Read more
You’re setting the link using PHP-generated JavaScript. I’m sure there are better ways to do this, e.g. just write the onclick handler into the div, or use an <a> tag for a link as usual, but if you want to it this way you should be using esc_js() not esc_url(). <script type=”text/javascript”> document.getElementById(“professionista<?= $query->post->ID ?>”).setAttribute( … Read more
RedirectMatch of Mod_Alias is not as powerful as Mod_Rewrite. If you have Mod_Rewrite on your host (Pretty Permalinks make use of it for example) you could make the redirect only if the URL is not in the Archive link format. To test for that case, there is RewriteCond and to make the redirect command, there … Read more