wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
_wp_copy_post_meta › WordPress Function
Od6.4.0
Przestarzałyn/a
› _wp_copy_post_meta ( $source_post_id, $target_post_id, $meta_key )
| Parametry: (3) |
|
| Zdefiniowane na: |
|
| Codex: |
Copy post meta for the given key from one post to another.
Powiązane Funkcje: add_post_meta, get_post_meta, update_post_meta, wp_add_post_tags, wp_get_post_tags
Źródło
function _wp_copy_post_meta( $source_post_id, $target_post_id, $meta_key ) {
foreach ( get_post_meta( $source_post_id, $meta_key ) as $meta_value ) {
/**
* We use add_metadata() function vs add_post_meta() here
* to allow for a revision post target OR regular post.
*/
add_metadata( 'post', $target_post_id, $meta_key, wp_slash( $meta_value ) );
}
}