Revision: 30294
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 11, 2010 12:19 by baires
Initial Code
add_action('publish_page', 'add_custom_field_automatically'); add_action('publish_post', 'add_custom_field_automatically'); function add_custom_field_automatically($post_ID) { global $wpdb; if(!wp_is_post_revision($post_ID)) { add_post_meta($post_ID, 'field-name', 'custom value', true); } }
Initial URL
http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/
Initial Description
Little code snippet for automatically adding a custom field for a page or post when they are published.
Initial Title
Adding A Custom Field Automatically On Post/Page Publish
Initial Tags
wordpress
Initial Language
PHP