Hot answers tagged

3

I know this topic is old, but I was having the same issue, and none of the suggested fixes worked. I didn't have any pages still in trash. I didn't have a category with the same name as my page. I didn't have another page with the same name. So I did something crazy. WP was trying to name my page as page-2, so I went to mywebsite.com/page to see what ...


2

Modifications of the core code are not recommended. Note that the core get_comments_link() function considers two cases of $hash: $hash = get_comments_number( $post_id ) ? '#comments' : '#respond'; Also note the second input argument is $post_id. Here's your modified example: add_filter( 'get_comments_link', function( $link, $post_id ) { $hash = ...


1

Changing arguments for a post type "on the fly" by changing the global at some random point in time is below ideal. When you look at register_post_type() there is the register_post_type_args filter. Example on how to use it as a small (mu-)plugin: <?php /** * Plugin Name: Change Post Type arguments for Post Type X */ add_filter( 'plugins_loaded', ...


1

There is a function that is looking for duplicated post names: wp_unique_post_slug. In this function are few queries, and one of them is looking for duplicated post names: SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1. If this query will return some rows then function will add suffix to post name. So you ...


1

Yes! Go to your Media Library Find the Image Click Edit Locate the Permalink under the Title Click Edit Change the Permalink Click Update! Edit If for some reason you cannot Edit the Images' Permalink... you could: Delete Image Change your Pages' Permalink Re-Upload Image


1

Duplicates don't just come from Pages and Posts, WordPress also defines Images and Files from the Media Library as "Posts". This means if you have a file / image in the Media Library with the same name as a page, it will assign the next duplicate a -2 ( from the wp_unique_post_slug() function ) so there's no URL conflicts. TL;DR - Duplicate? Search for ...


1

Try creating a custom rewrite rule and a custom rewrite tag. This should allow you to set up a regular expression to capture the ID and manipulate the query. Rewrite API/add rewrite rule « WordPress Codex https://goo.gl/kdEJd8 Rewrite API/add rewrite tag « WordPress Codex https://goo.gl/PVLzLh



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