Support

Account

Home Forums Bug Reports Create ACF Fields when Post Created Programmatically

Unread

Create ACF Fields when Post Created Programmatically

  • I am using ACF to manage additional fields attached to a few different WP Post Types (native, WooCommerce and Custom Post Types). Some of these Posts are created programmatically using wp_insert_post().

    I have noticed that Posts created through the WordPress Backend have all of the expected ACF fields present, but when a Post is created programmatically, it has no ACF fields – they need to be set manually using update_field().

    This is not expected behaviour.

    I am suggesting that ACF should hook the appropriate action so that the creation of ACF fields is uniform between manual and programmatic Post creation. (Possibly with a switch which allows the “Required” rules to be overridden, where used.)

    As it stands, rather than looking at the ACF fields attached to a Post which has been programmatically generated, I instead have to ask ACF what fields should be there, and then loop through them and generate them myself.

Viewing 1 post (of 1 total)

The topic ‘Create ACF Fields when Post Created Programmatically’ is closed to new replies.