The slug is saved on the wp_posts while custom fields are on the wp_posts_meta. If you want to make it like that you can use an action hook on save_post that will get the value of the custom fields and saves it as the post slug.
Here is the code
add_action('save_post', 'set_slug');
function set_slug($post_id){
$new_slug = get_post_meta($post_id,'custom-slug', true);
$post_args = array(
'ID' => $post_id,
'post_name' => $new_slug,
);
wp_update_post($post_args);
}
Related Posts:
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Where is the old post permalink slug stored?
- Use category base slug in posts’ permalink
- How to automatically generate a unique random slug
- Post slugs and images cannot have same name?
- Change the Slug of Post Type post to baseurl/post/%postname%
- Update all posts automatically when using post_meta
- How to control which category will be picked for the slug of a post?
- Bulk update post slugs through database
- How to handle broken links created by permalink/slug changes?
- Visting slug for ‘post’ post type shows 404 not archive?
- how do i add posts-page slug before posts slug in permalinks
- Custom permalink for each post
- Categories Listing and Highlighting current category item
- Private post caught in endless redirect loop
- How to 301 redirect from url with post id to permalink with post name (slug)?
- My post permalinks are always the same
- Echo author slug in post edit page
- Modify WP_Post before processing
- Dynamically generate child-URLs for posts or custom posts
- Save re-arranged draggable post items to wordpress database
- Accessing post->ID outside of the loop for listing child pages
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- how to set beforsend option in wordpress ajax methods
- Change post_date to post_modified date on post template?
- Adding parent pages to posts
- WordPress custom slug (endpoint) and compare all links
- Plain permalinks not working!
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Removing rel=”nofollow” from links posted in Post Content
- How to change permalink on post click on post listing page
- Display post category in foreach loop with category link
- Changing Permalinks for Default Post type to reflect navigation
- How should I add links to other pages/posts from my post?
- WordPress not opening posts with only numbers if permalink is post_name
- WordPress Custom Fields (Checkboxes with multiple values)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- How can I sort posts by the date and a custom meta field?
- is there a way to show the the post title after the image?
- Get Meta Key Value While Saving Post
- Most liked page not displaying posts
- How to make number of blog posts a custom field?
- Using permalinks, category slugs, and tag slugs
- 200 Rewrite blog post links
- php script to change slug in post automatically
- Problem with permalink routing?
- Move first half of posts to one parent page, second half to the other page
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- How to check a post exist when the permalink has post id in it?
- Force the “Choose from the most used tags” meta box section to always be expanded
- After database migration, posts not showing up in dashboard
- Meta value does not save for scheduled posts
- Custom Posts Query and meta_query Sort Order
- How to do set post permalinks using 6 digit random unique function?
- Switch to page template when using post permalink
- How to have posts have a parent in permalink like site.com/blog/postname
- Trying to use AngularJS with WordPress without any API
- Automatically add date to the auto generation of post slug
- How to compare two posts including their meta fields on a scalable base?
- How could I change my Permalink from blog to custom structure? [closed]
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Getting value from get_post_custom
- Any way for get_next_post() to use the actual post order instead of publish order?
- Calling Different Custom Post Timestamps in a table
- Creating a post from data returned from HTML form
- Is it possible to paste a link without tags and make it directly a link in a post?
- Cannot retrieve a custom RSS field from posts
- List authors with the last post title and order by last post date
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Retrieve post ID from “querying” URL
- Saving custom fields to a custom taxonomy
- hiding permalink in admin if the user is subscriber
- Why does WP_Post not contain its permalink?
- the_permalink() not working in a root installation
- Redirect to another page using contact form 7? [closed]
- Display post category in foreach loop
- How to automate featured posts number? [duplicate]
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- How to get a post’s content? [closed]
- Page template is accessing the incorrect posts?
- Disable WordPress Archive Conflict Check
- Customize rel=canonical tag for single blog post
- Change all author links in Blog roll
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- Second get_permalink inside loop points to wrong URL
- How to calculate the average of a post meta value(Numeric) of a specific author
- Is there any way to tell when wp_postmeta has been updated?
- Can’t get full post title if there a spaces in title
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- Two Custom Post Types with Identical Articles Competing for the same Slug
- WordPress custom post type with folder structure in slug
- wpColorPicker – problem with implementation to post meta
- How can I remove the first two words and shorten get_the_title()
- Custom Permalink Structure for Pages & Posts
- Change post author without using wp_update_post()
- if in category but only with post meta
- my post slug gets really long and I can’t change it
- Replace image name on upload to the new post name on front-end form