Support

Account

Forum Replies Created

  • I did but the acf images gallery is empty after import.

    I i manually add images in the gallery field , this what i get with WP EXPORT
    https://mysite.com/wp-content/myimage1.jpg|https://mysite.com/wp-content/myimage2.jpg

    So when i put the same url in file to import , the acf gallery is empty after import.

    (images files are already in media library, root folder)

  • Thanks a lot !

  • actually get_field ( ‘visibilite’, $term->term_id ) is empty and also get_post_meta( $term->term_id , ‘visibilite’)

    the value is in databae :
    https://snipboard.io/HLsJIG.jpg

  • i have tried this, but it does no work:

    // exclude categories from category dropdown
    add_filter('acf/fields/taxonomy/query/name=materiel_client', 'exclude_categories', 10, 2);
    function exclude_categories( $args, $field ) {
      $terms = get_terms([
        'taxonomy' => 'materiel_client',
        'hide_empty' => false,
    ]);
    
    $excluding = array();
     foreach ($terms as $term)
     {
     // $temp.=get_field ( 'visibilite', $term->term_id  );
     
     if (get_post_meta( $term->term_id , 'visibilite')=='oui'){
     array_push($excluding , get_post_meta( $term->term_id , 'visibilite'));
     }
     }
     
       $args['exclude'] = $excluding; //the IDs of the excluded terms
      return $args;
    }
  • Thanks it is a great news !

  • If i place acf_form() in a woocommerce checkout hook, do you think it could work ?
    https://www.businessbloomer.com/woocommerce-visual-hook-guide-checkout-page/
    thanks

  • Thanks but is it possible to have only one button to save acf field and checkout fields ?

  • this is what is returned in $field

    Array ( [ID] => 0 [key] => field_5a47128676459 [label] => Utilisateur [name] => acf[field_5a47128676459] [prefix] => acf [type] => user [value] => [menu_order] => 0 [instructions] => [required] => 0 [id] => acf-field_5a47128676459 [class] => [conditional_logic] => 0 [parent] => group_5a471067bee5c [wrapper] => Array ( [width] => [class] => [id] => ) [role] => [allow_null] => 0 [multiple] => 0 [return_format] => id [_name] => _user_id [_valid] => 1 [_prepare] => 1 )

  • I can see yy with this but unfortunately i only see customer role in the list

    add_filter(‘acf/prepare_field/key=field_5a47128676459’, ‘my_set_role_filter’);
    function my_set_role_filter($field) {
    print_r (“yy”);
    if (current_user_can(‘shop_manager’)) {
    $field[‘role’] = ”;
    }
    return $field;
    }

  • I can see yy with this but unfortunately i only see customer role in the list

    add_filter('acf/prepare_field/key=field_5a47128676459', 'my_set_role_filter');
    function my_set_role_filter($field) {
    	print_r ("yy");
      if (current_user_can('shop_manager')) {
        $field['role'] = '';
      }
      return $field;
    }
  • yes i did , strange…
    i have tried both…

    add_filter('acf/prepare_field/key=field_5a47128676459', 'my_set_role_filter');
    function my_set_role_filter($field) {
      if (current_user_can('shop_manager')) {
        $field['role'] = '';
      }
      return $field;
    }
    
    add_filter('acf/prepare_field/key=acf-field_5a47128676459', 'my_set_role_filter');
    function my_set_role_filter($field) {
      if (current_user_can('shop_manager')) {
        $field['role'] = '';
      }
      return $field;
    }
  • thanks unfortunately i have tried with name=_user_id and key=select2-acf-field_5a47128676459 but it still display only customers…

  • oh thanks , and should i complete this ?

    $field['role'] = '';

  • do you mean simply this ? $field[‘role’] = ‘shop_manager’;

    my need is that the user shop manager could see all the role in the list (like admnitrator can see). Actually the list is limited to customers.
    thanks

  • i chnage dmy slug values to _0, _1, _2, _3
    and i do:
    $args = array(
    ‘post_type’ => ‘maintenance’,
    ‘posts_per_page’ =>-1,
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘urgence’,
    ‘order’ => ‘ASC’,
    );

    and it seems that it’s ordered by the terms id…and not alphabetically

  • oh yes this is smart !

  • may be that also
    if ( get_post_status ( $post_id ) ) {
    // returns false if post doesnt exist
    }

  • so as i need it for frontend + backend, i must use save_post ?

  • very strange because same number of items (line items) but white with no text…

  • what is strange is that when i use the filter as written in demo only to test, my list is empty (there are line items but no text…

    function my_post_object_result( $title, $term, $field, $post_id ) {
    
        // add the term's slug to each result
        $title .= '(' . $term->slug .  ')';
    
        return $title;
    
    }
    
    add_filter('acf/fields/taxonomy/result', 'my_taxonomy_result', 10, 4);
  • Yes maybe ACF could change the look of taxonomy field.

    But yes also, in my case, maybe can i use the filter you tell me, can i insert html tags into ?

    I wish:

    FIRSTLEVEL

    <padding 20px> 2nd level
    <padding 20px> 2nd level
    <padding 20px> 2nd level

  • so, imagine my CPT is MOVIE.
    My custom taxonomy MOVIE GENRE = (Animation, Horror, Action…)

    i have 2 Taxonomy fields i my form : Genre#1, Genre#1
    Both are linked and populated with MOVIE GENRE.

    I choose Animation for Genre#1 and Action for Genre#2.

    I display this data in admin columns, and so i have Animation,Action in column Genre#1 and Animation,Action in column Genre#2, instead of Genre#1:Animation Genre#2:Action this is the problem !!

    I know wp_set_object_terms() and do you think i have no other choice to use it ?
    thanks

  • but they must be synced to the custom taxonomy to do searches

  • In my taxonomy ‘from’ i have only 2 values, ID are 68 and 69.
    So update_field(‘from’, ’69’, $post_id);
    should automatically set the from value isn’t ? because it does not.

    Actually I have removed the taxonomy radio field because i don’t want the user can choose it. So can i directly update the taxonomy value when ACF save post ?
    thanks

    thanks for help

Viewing 25 posts - 1 through 25 (of 64 total)

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.