• So now that I’m fiddling around more and more with ACFE and ACF Frontend, here I come with another question regarding multiple categories.

    So apparently ACF Frontend isn’t able to set more than the last category to a post. Is there eventually someone who faced the same issue and might have a workaround or tip on how to solve the problem?

    I have a ACF Field Group with multiple Taxonomy Terms (categories), conditional logic etc., displaying that with the “ACF Field” type in ACF Frontend. Displays properly with radio buttons, checkboxes, selects – but once clicking on submit, the post has just one single category selected.

    Hope someone can help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    This forum is dedicated to the ACF Extended plugin. If you need help with a third party plugin, I would recommend to open a ticket support the related forum.

    If you need to setup advanced ACF front-end forms with more features and control, I suggest you to try the ACF Extended Form module.

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter dmkrtz

    (@insane2803)

    Thanks for the reply.

    You’re right! After your reply I abandoned ACF:FE and worked out how ACF:E Forms work, and it’s fantastic. Exactly what I’m looking for.

    Only issue I’m facing right now is the fact that when submitting a new post through the form or updating a post, the transition_post_status gets fired 3 times – causing a “Post to Discord” function aswell as my “Followers” plugin to send 3 messages at once. I worked that out by adding some if functions which do their job OKish.

    Another thing I’m struggling with is the Post Status “Scheduled (future)” – I have a select input where I can select the values publish or future, then a post published on input, selected the post status field for “Post Status” and yet my post gets published immediately, but with the altered publish date.

    Is there anything I’m missing?

    Thanks in advance!

    • This reply was modified 2 years, 9 months ago by dmkrtz.
    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    The “Post Create” action will trigger 2 transition_post_status:

    • new > draft
    • draft > publish

    This is because the post needs to be created first in order to retrieve the “Generated ID”, so it can be used as “Post Title” in the Form UI. See screenshot.

    Unfortunately, that logic can’t be bypassed, as it’s the only way to be 100% sure the new genereated post ID is correct.

    Regarding the Post Schedule, note that you have to set a later post_date during the post creation (or update), in order to correctly schedule it. Otherwise WordPress will simply create the post and immediately publish it because the date has passed.

    In order to set a custom argument (such as post_date) during the post creation, you’ll have to use the acfe/form/submit/post_args hook (See documentation). This hook will let you customize the post arguments, just like when using the native wp_insert_post() function (See documentation). I would recommend to check that function documentation, so you’ll get a good idea of all possible customization.

    Regarding the post schedule on its own, here is a usage example that will schedule the post to +1day after the form submission:

    add_filter('acfe/form/submit/post_args/form=my-form', 'my_form_post_args', 10, 4);
    function my_form_post_args($args, $type, $form, $action){
        
        // schedule post
        $args['post_date'] = date('Y-m-d H:i:s', strtotime('+1day', current_time('U')));
        $args['edit_date'] = true;
        
        // return
        return $args;
        
    }
    

    You can check the strtotime() PHP function documentation in order to understand how it works.

    You’ll find some topics on Stackoverflow here and here about how the wp_insert_post() works with scheduled dates.

    Note that you don’t need to set the post_type to future in order to schedule a post. Even if it is set to publish, WordPress will automatically schedule the post if it is set to a later date.

    Regarding the Form UI settings allowing to set a future date, that setting is not available yet, because it has to be compatible with relative dates (+1day) and absolute dates (Y-m-d H:i:s), which makes it a bit more complex than other fields. It will come in a future update tho.

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Categories with ACF Extended & ACF Frontend’ is closed to new replies.