Support » Plugin: ACF Frontend Form for Elementor - Add and edit posts, pages, users and more » How to display some categories for the submission form, not all?

  • Resolved whateverfree2

    (@whateverfree2)


    Hi

    I am trying to create a submission form, let users submit post to Real Estate category and its sub categories

    How to display Real Estate category and its sub categories as the drop down box so users can choose when submit the post?

    I do not want display all categories of the site in the Drop Down

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    Hi

    Did email about this today. I have been getting a lot of questions regarding taxonomy fields, so I want to make a video on it.

    What you are going to want to do is create a taxonomy field in ACF. Choose categories as the taxonomy type. Then turn on load terms and save terms and select which caregories you want to show as options. Finally, in the widget select this field and for the “post categories” field choose “None/Custom”.

    Please let me know if this works

    Regards

    Thank you for your quick answer

    – I’ve created a STaxonomy Field in ACF and make it display in the form (frondend)

    But I can’t find the option in your words “and select which caregories you want to show as options”.

    Where to select the categories to display?

    Thanks

    Plugin Author Shabti Kaplan

    (@shabti)

    Hey, my bad this is not actually an option in this field but it should be. Replace {$field_name} on the bottom line with your field name and then put this in your functions.php file in your child theme. Warning, test this on a staging site first.

    function my_taxonomy_query( $args, $field, $post_id ) {
        
        // modify args
        $args['child_of'] = 'your_main_category_id'; 
        
        // return
        return $args;
        
    }
    
    add_filter('acf/fields/taxonomy/query/name={$field_name}', 'my_taxonomy_query', 10, 3);

    Plaese refer to this page for further information: https://www.advancedcustomfields.com/resources/acf-fields-taxonomy-query/

    Hi

    I tried but it does not work, still display all categories

    Will you add this feature to the next release? It’s must have, I can order the pro version to have this feature, cause I have multiple submit forms for multiple groups so can’t use this way to display category for each form.

    function my_taxonomy_query( $args, $field, $post_id ) {
        
        // modify args
        $args['child_of'] = '131'; 
        
        // return
        return $args;
        
    }
    
    add_filter('acf/fields/taxonomy/query/name=mycustom_category_fieldname', 'my_taxonomy_query', 10, 3);
    

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to display some categories for the submission form, not all?’ is closed to new replies.