Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Post
- -- image
- -- Featured image
- -- body
- echo '<pre>';
- print_r(get_post_custom($post_id));
- echo '</pre>';
- function get_all_meta($type){
- global $wpdb;
- $result = $wpdb->get_results($wpdb->prepare(
- "SELECT post_id,meta_key,meta_value FROM wp_posts,wp_postmeta WHERE post_type = %s
- AND wp_posts.ID = wp_postmeta.post_id", $type
- ), ARRAY_A);
- return $result;
- }
- function acf(){
- $options = array();
- $acf = get_all_meta('acf');
- foreach($acf as $key => $value){
- $options['post_type'][$value['post_id']]['post_id'] = $value['post_id'];
- $test = substr($value['meta_key'], 0, 6);
- if($test === 'field_'){
- $post_types = maybe_unserialize( $value['meta_value'] );
- $options['post_type'][$value['post_id']]['key'][] = $post_types['key'];
- $options['post_type'][$value['post_id']]['key'][] = $post_types['name'];
- $options['post_type'][$value['post_id']]['key'][] = $post_types['type'];
- }
- if($value['meta_key'] == 'rule'){
- $post_types = maybe_unserialize( $value['meta_value'] );
- $options['post_type'][$value['post_id']]['post_types'] = $post_types['value'];
- }
- }
- return $options;
- }
- foreach(acf() as $key => $value){
- update_post_meta(76, $value['type'], 'Steve');
- }
- $result = $wpdb->get_results($wpdb->prepare(
- "SELECT ID,post_title,post_parent FROM wp_posts WHERE post_type = %s", $type
- ), ARRAY_A);
- // pods each field for a post type create separate post type so again query to get the field post type result.
- $pods_field_post_type = array();
- foreach($result as $value){
- $pods_field_post_type = $wpdb->get_results($wpdb->prepare(
- "SELECT ID,post_title,post_name FROM wp_posts WHERE post_type = %s
- AND post_parent = %d
- ", '_pods_field',$value["ID"]
- ), ARRAY_A);
- }
- $fields = array();
- foreach($pods_field_post_type as key => $value):
- $podsAPI = new PodsAPI();
- $pod = $podsAPI->load_pod( array( 'name' => '
- post' ));
- $fields[] = $pod['fields'][$value['post_name']]['type'];
- endforeach;
- }
- print_r($fields);
- foreach($fields as $key => $value){
- update_post_meta(76, $value, 'Steve');
- }
- $post_type_features = get_all_post_type_supports( 'post' );
- print_r( $post_type_features );
- /* Array
- * (
- * [0] => author
- * [1] => editor
- * [2] => thumbnail
- * [3] => excerpt
- * [4] => trackbacks
- * [5] => custom-fields
- * [6] => comments
- * [7] => revisions
- * [8] => post-formats
- * [9] => title
- * )
- */
- $post_type_object = get_post_type_object( 'post' );
- print_r( $post_type_object->supports );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement