Aggiungendo questo snippet all'interno del file functions.php del vostro tema WordPress verrą aggiunto un campo personalizzato quando un post o una pagina viene pubblicata. Non dimenticate di cambiare le voci FIELD_NAME e CUSTOM VALUE.
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); } }



Leave Your Response