Tag Info

Hot answers tagged

4

Regarding the why part, I think I've traced this to the following line: $title = preg_replace('|-+|', '-', $title); within the sanitize_title_with_dashes() function. It's added to the santize_title() via the filter: add_filter( 'sanitize_title', 'sanitize_title_with_dashes', 10, 3 ); but I wouldn't recommend removing it totally. Update: Here's a ...


3

The culprit here is sanitize_title() via the sanitize_title hook. The function hooked to it is sanitize_title_with_dashes(); I see @birgire tracked it down too, as it can be seen in wp-includes/default-filters.php. add_filter( 'sanitize_title', 'sanitize_title_with_dashes', 10, 3 ); You can use remove_filter() to do just that. ...


2

Firebug's "Network" tab should tell you, or something more aggressive like Wireshark. The wp-admin/admin-ajax.php file does fire the admin_init hook so you could use that to create a log. Something like: function log_ajax_wpse_189827() { if (defined(DOING_AJAX) && TRUE === DOING_AJAX) { error_log("Howdy!"); } } ...


2

If we trace the Ajax process after you click OK, we would walk the following path from the core and into the database: Press OK on Edit slug: \ \-> AJAX POST request with action=sample-permalink Action: wp_ajax_sample-permalink \ \-> function: wp_ajax_sample_permalink() \ \-> function: get_sample_permalink_html() ...


2

As you guessed and @Rarst suspected, there's a pagination check in wp_unique_post_slug() for hierarchical post types: preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) which will match any numeric only slug, optionally preceded by "page". To get around this you could use the 'wp_unique_post_slug' filter, basically replicating the original ...


2

It sounds like you need get_author_posts_url() which "Gets the URL of the author page for the author with a given ID." If you have set the custom permalink correctly it should work. If you really are looking for actual page IDs, there is no page ID for an author archive page. Those pages are dynamically generated and are not "posts", "pages", or any other ...


2

It's not clear from your question if you actually want the word/number structure or you merely use numbers to distinguish endpoints as different. Natively in WordPress there is no concept of endpoint with variable name. You can use add_rewrite_endpoint() to create a endpoint endpoint, which will match requests like .../endpoint/123, .../endpoint/124, and so ...


1

I know this is an old post, but I think there is wrong information here. I was having conflicts with slugs between different custom post types and taxonomies and decided to do some reading about it to understand it better. I am using WordPress 4.2.2, and I am able to create different posts types with the same slug. Apparently this is a known issue being ...


1

This can be a real pain, I know firsthand. The obvious place (that I sometimes forget) is your Trash folder. If it's not there, I would suggest re-saving permalinks. As a last resort, I'd do what you said... a bunch of searches of the database. One time a plugin had auto-generated a page, and after disabling and deleting the plugin, I found the bad URL in ...


1

I ended going the CPT route, as I couldn't figure out other way. Just added a bunch of logic to duplicate/modify/delete the normal posts when needed. <?php // function for the CPT function SU_kuuma_kysymys_type() { // creating (registering) the custom type register_post_type( 'kuuma_kysymys', /* ...


1

After some brainstorming and a lot of trial and error with T5 Rewrite and HM Rewrite, I went for the simplest possible solution. The permalink was actually intercepted by WordPress so I didn't need the additional rewrite rule (even though it didn't hurt, other than performance). I left %category%/%post_id%/%postname% as the default custom permalink, and it ...


1

It would be more correct to say that CPTs can be hierarchical and non–hierarchical. Page and post are just respective examples of such, and by the way as native post types they aren't quite the same thing as CPTs. Clearly, when you have multiple CPTs in a site it's important that not a single combination of slugs leads to ambiguous permalink, that might ...



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