Skip to main content
2 votes
Accepted

Dynamically change page permalink name often

You can dynamically change the permalink of a specific page programmatically. We can achieve this with the help of WordPress hooks and a custom function these two will update the page slug at a ...
Narendra Sishodiya's user avatar
2 votes

Disable Attachment Pages Completely

This is now the default in WP 6.4 and can be set using the wp_attachment_pages_enabled option. Changes are possible via CLI: wp option set wp_attachment_pages_enabled 0|1 by visiting /wp-admin/...
Tom J Nowell's user avatar
  • 60k
2 votes
Accepted

Custom Post Types, Single Posts returning 404 Errors - flushing permalinks does not correct

The issue you're facing might be due to a conflict with the slug of your custom post type and a page, post, or another custom post type. From the JSON you've provided, it seems like the slug for your ...
alexandrucarjan's user avatar
1 vote
Accepted

How to make 2 (or more) custom post type post pages sit under the same slug?

You were getting /video-demos-tours/post-name instead of /resources/post-name because the following line in your theme_build_post_args function is setting the rewrite slug to the post type slug (video-...
Sally CJ's user avatar
  • 39.7k
1 vote

Change permalink structure for custom post type

If you look at the rewrite argument for register_post_type, there is a with_front option to disable the default base that is prepended to the custom post type permalink. If you set this to false, /...
Brennan's user avatar
  • 201
1 vote

Wordpress per ACF - permalink is not working

get_the_permalink() returns the permalink as a string and doesn't echo it. You either need to echo this yourself <?php echo get_the_permalink(); ?> as you've got in some of your other <?php ...
Rup's user avatar
  • 4,342
1 vote
Accepted

Processing data and redirecting with query string

Is everything I need to code here? If it works then yes! If it does not work then no there is stuff missing. Only you can answer this by opening the site and checking if it does what it's supposed to ...
Tom J Nowell's user avatar
  • 60k
1 vote
Accepted

Is there a way to auto-link to products when writing a post?

We can type ctrl+k in the editor to activate the link search: that will search in all public post types. We can also type [[ in the editor to get the link inserter for latest posts.
birgire's user avatar
  • 67.6k
1 vote

Modify Post URL Programmatically

When you are using wp_insert_post() there is a param post_name. If you do not pass it then it will sanitise your post title and update. You only have control to add post_name but the full URL is ...
Aftab's user avatar
  • 1,391
1 vote

Changing permalink won't redirect to new version of page

Browsers are pretty bad about hard-caching redirects. I would first use an HTTP header checker (there are many free ones online, just search) to verify the URL you want really is still redirecting. If ...
WebElaine's user avatar
  • 9,600
1 vote
Accepted

Execute wp_after_insert_post after the permalink is customized

To execute update_post_meta after the permalink is customized, you can use the save_post hook instead of wp_after_insert_post. Here's how you can modify your code: add_action('save_post', '...
Will Ashworth's user avatar
1 vote

Yoast SEO canonical URL gets pointed to the homepage

I noticed that all problematic posts had their wp_yoast_indexable row updated a few months ago which exactly matched with when I ran a script to update all existing posts. It was something like this: $...
dodov's user avatar
  • 197
1 vote

How do I get the URL section to show use a different domain in the WordPress Admin?

You can use the post_link filter to do this. Example: function modify_post_link( $url, $post, $leavename=false ) { if ( $post->post_type == 'post' ) { $url = str_replace(home_url(), 'https://...
Lee Wise's user avatar
  • 111
1 vote
Accepted

button onclick with get_post_permalink

get_post_permalink() only returns the value. You still need to echo it (and escape it for good measure): <?php echo esc_url( get_post_permalink() );?>
vancoder's user avatar
  • 7,904
1 vote

Custom Post Types, Single Posts returning 404 Errors - flushing permalinks does not correct

Thank you to alexandrucarjan for the path to getting a temporary workaround on this issue. The answer was in the permalink and the URL rewrite. But, it was centered around nesting the video custom ...
Mitch S's user avatar
  • 27

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