Problem with ading customfields within functions.php
-
hi @ all,
i’ve got a problem by adding customfields into ma wiordpress theme. the name/id of the customfield shell be predefined, the Text/value shell be customizable.
[php]
add_action( ‘save_post’, ‘kb_custom_field_default’, 10, 2 );
function kb_custom_field_default( $post_id, WP_Post $post ) {
if (!get_post_meta( $post_id, ‘CUSTOM-FIELD-KEY’, true ) ) {
update_post_meta( $post_id, ‘a, ‘value1’ );
update_post_meta( $post_id, ‘b’, ‘value2’ );
update_post_meta( $post_id, ‘c’, ‘value3’ );
}
}[/php]
So how can i release this. ID/name is working but the value is always the one i typed into the functions.php (value1, value2, value3) how can i change that to custom text?
best regards
The topic ‘Problem with ading customfields within functions.php’ is closed to new replies.