Created
March 22, 2013 03:46
-
-
Save spencejs/5218809 to your computer and use it in GitHub Desktop.
Add Custom Field and Value To All Pages On Publish In Wordpress
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
| //Add Custom Field and Value to all pages | |
| add_action('publish_page', '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, 'ngg_gal_Images', '42', true); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment