test add action on post publish

- but don't retrieve coordinates yet
+ test differents functions for custom fields
This commit is contained in:
lenovo
2022-11-05 10:53:21 +01:00
parent 7b37d30f7b
commit 66aa25c4b0
2 changed files with 79 additions and 1 deletions

View File

@@ -84,4 +84,16 @@ function mp_add_div() {
}
add_shortcode('lejourduprof_map', 'mp_add_div');
/**
* when a post is published, check its coordinates
*/
function post_published_coordinates($id, $post) {
if ( ! add_post_meta( $id, 'coordinates', 'banana', true ) ) {
update_post_meta( $id, 'coordinates', 'banana' );
}
}
add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
?>