Home Forums ACF PRO new_post on acf_form not working after v4 -> v5


new_post on acf_form not working after v4 -> v5

  • I have a site using the latest version of ACF Pro that was not an upgrade, meaning I installed ACF Pro fresh without the existence of ACF4 at all. On another site I have upgraded to ACF5 from ACF4. On the first site, I can use the acf_form options new_post just fine and it creates post as it should, on the second site, it doesn’t work and no new post is created. Also, if I add a parameter for field_groups ('field_groups' => array('42')), it’s gives me the error “Warning: array_merge(): Argument #2 is not an array in /home4/cummings/public_html/wordpress/wp-content/plugins/advanced-custom-fields-pro/api/api-template.php on line 1296”.

    Did something maybe go wrong with my database? I upgraded it and it said it worked successfully, but I’m stumped as to why this isn’t working now.

    • Elliot

    • August 7, 2014 at 3:31 pm

    Hi @arcanepsyche

    Thanks for the bug reports. I’ll add some conditional to prevent the error, however, can you confirm that a field group exists for the ID of 42?


  • That was the problem indeed, it turns out. The ID of the field was changed, I think, when I upgraded.

    Still trying to figure out why the new_post isn’t working in this installation. I’m using the exact code on both sites for creating a new post, but no luck on later one. I’m guessing it’s something I haven’t found in my own work though, so I’ll keep looking. Thanks Elliot!

    $newapp = array (
    				'post_id' => 'new_post',
    				'new_post' => array(
    					'post_type' => 'appointment',
    					'post_status' => 'publish',
    					'post_title' => 'tempslug', 
    				'field_groups' => array('414'),
    				'form_attributes' => array (
    					'id' => 'new-app-form',
    				'submit_value' => 'Post Appointment',
    				'update_message' => false,
    				'return' => add_query_arg(array('adminTab'=>'apps', 'sub-tab'=>'available', 'appcreated'=>true), get_the_permalink()),
  • I was able to discover what was wrong finally. Another custom post type I hadn’t converted was preventing post creation. Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

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.