Only problem now is i have to go into every single post, click edit and save or the title is just “(no title)”.
If i try to do this via quick edit, it doesnt update either.
Any solution to this anyone?
Got it to work by changing the post_title to new_title in your code.
Hopefully this is correct
Thanks a million!
Thankyou for that. Would i just use the code as you have types it, or would i need to edit to $new_title?
$post->post_title = get_field('site_name', $post_id).' '.get_field('site_location', $post_id);
if ( get_post_type( $post_id ) == 'sites' ) {
<ul>
$new_title = get_field( 'site_name', $post_id );</ul>
$new_slug = sanitize_title( $new_title );
}
Can anyone point me in the right direction for a similar outcome but without the date. Instead i would just like to combine two ACF fields like for example “site_name – site_location”
I have tried manipulating the code above, but cannot get them to combine the two together.
Thanks in advance