dynamically update permalink and title with the values of custom fileds

You don’t need to hide the title. To my knowledge there is atleast two way to do this, one is manual and other through codes.

Manual way:–

After you are done with adding the title, if your permalink doesn’t match the title just click on permalink Edit button clear the text and click OK. It will get you the permalink as per the title.

Through Code:–

Put the below code in the theme’s functions.php file.

add_filter( 'wp_insert_post_data', 'wpse_121035', 50, 2 );
function wpse_121035( $data, $postarr ) {
    //Check for the  post statuses you want to avoid
    if ( !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {           
        $data['post_name'] = sanitize_title( $data['post_title'] );
    }
    return $data;
}

The above will automatically change the permalink of the post on the fly.

For more detail on how you can use it follow this blog

Leave a Comment