Created
May 25, 2023 06:49
-
-
Save nikitasinelnikov/35a29b568273f7f99ec1a754b71e6a32 to your computer and use it in GitHub Desktop.
JobBoardWP: Change the job slug on insert post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_custom_date_add( $data, $postarr, $unsanitized_postarr, $update ) { | |
if ( 'jb-job' === $data->post_type ) { | |
$data->post_name = wp_date( 'Y-m-d', strtotime( $data->post_date ) ) . $data->post_name; | |
} | |
return $data; | |
} | |
add_filter( 'wp_insert_post_data', 'my_custom_date_add', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment