Home Forums Front-end Issues Form to post:


Form to post:

  • I’ve spent the last two days trying to build “form to post” mechanism for my music website, but am not getting anywhere, so I’m posting it here.

    Basically, I created a custom form with ACF Pro (v. 5.4.7) that includes various album-related information (name, artist, description, cover image, year published, length, rating).

    I built an add-music.php page that is supposed to contain a form to enter a new album and have it posted to the site, and a single-music.php for displaying those posts.

    I also use the Custom Post Types UI plugin for creating the “music” post types.

    The closest I’ve come to making it work is this:

    $arguments = array(
        'field_groups'  => array(123),
        'return'        => home_url('thanks'),
        'post_id'       => 'new_post',
        'post_title'    => true,
        'new_post'      => array(
            'post_status' => 'publish',
            'post_type'   => 'music',
            'post_title'  => the_field('albumtitle')
        'submit_value'  => 'Add Album'

    The problem is that this doesn’t really do what I thought it would do.

    Instead of using my ACF-created ‘albumtitle’ field that is part of form 123, it adds a completely new and unrelated “title” field to the top of my form.

    The title entered there is then actually used as the title of the new post, but the the field from my form is ignored. If I change the code to not display that field but only the actual form field the WP title is not adjusted.

    I could remove my own title field of course, but then I still wouldn’t know how to access all the other values.

    Thanks for your help!

  • If you want to use and ACF field for the post title then you need to create an acf/save_post or acf/update_value filter that will get the value from the field and update the post title. There are some examples of how others have done this on the forum, here are some links.

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

You must be logged in to reply to this topic.