php - Custom Fields not showing in custom post type post -


i have custom post type named "designer" each posts using different unique advanced custom fields each posts has unique templates.with below code able give rules each posts in designer post type , save custom fields not displaying on post edit pages on backend. code should ork no idea happend code

please help.

add_filter('acf/location/rule_types', 'acf_location_rules_types'); function acf_location_rules_types( $choices ) {     $choices['custom post types']['cpt_parent'] = 'custom post type parent';      return $choices; } add_filter('acf/location/rule_values/cpt_parent',    'acf_location_rules_values_cpt_parent'); function acf_location_rules_values_cpt_parent( $choices ) {     $args = array(         'hierarchical' => true,         '_builtin' => false     );     $posttypes = get_post_types( $args );      if( $posttypes )     {         foreach( $posttypes $posttype ):              if( $posttype != 'acf' ):                 $args = array(                 'post_type' => 'designer',                 'posts_per_page' => -1,                 'post_status' => 'publish'                 );                 $customposts = get_posts( $args );                   if ( $customposts  ) {                     foreach( $customposts $custompost ){                         $choices[ $custompost->id] = $custompost->post_title;                     }                 }             endif;         endforeach;     }      return $choices; }  //match rule add_filter('acf/location/rule_match/cpt_parent',              'acf_location_rules_match_cpt_parent', 10, 3); function acf_location_rules_match_cpt_parent( $match, $rule, $options ) {     global $post;     $selected_post = (int) $rule['value'];      // post parent     $post_parent = $post->post_parent;     if( $options['page_parent'] ) {          $post_parent = $options['page_parent'];      }      if ($rule['operator'] == "=="){         $match = ( $post_parent == $selected_post );     }     elseif ($rule['operator'] != "!="){         $match = ( $post_parent != $selected_post );     }      return $match; } 

enter image description here

your artist collection field group set appear on 1 post, post designer post 1 designer post type.

i don't understand code for? create different field group each post needs different field group , separate rule each.

ok sorry understand issue , have recreated issue on local install.

on line of code below looking post_parent think should looking id.

i changed this:

$post_parent = $post->post_parent; 

to this:

$post_parent = $post->id; 

and it's working me.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -