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 ...
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/...
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 ...
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-...
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, /...
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 ...
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 ...
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.
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 ...
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 ...
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', '...
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:
$...
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://...
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() );?>
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
permalinks × 3185custom-post-types × 657
url-rewriting × 473
custom-taxonomy × 287
rewrite-rules × 261
urls × 222
categories × 211
posts × 194
slug × 187
htaccess × 182
404-error × 179
redirect × 157
pages × 129
plugins × 115
php × 115
customization × 92
plugin-development × 82
links × 82
taxonomy × 60
pagination × 60
functions × 57
archives × 57
multisite × 54
woocommerce-offtopic × 50
templates × 50