Discussion on Quick and easy Post creation for ACF Relationship Fields PRO

Bazalt

Bazalt supports this item

Supported

27 comments found.

I’m registering the fields and field groups via PHP instead of using the ACF interface. Do you have any documentation on how to enable the on-the-fly post creation on a field using PHP?

Simply specify ‘acf_relationship_create’ => 1, in your field declaration:
if( function_exists('acf_add_local_field_group') ):

acf_add_local_field_group(array (
    [...],
    'fields' => array (
        array (
            [...]
            'type' => 'relationship',
            'acf_relationship_create' => 1,
            [...]
        ),
    ),
    [...]
));
endif;

Hey Bazalt,

Great little add-on. Can’t tell you how many times I’ve wanted this functionality over the last few years. Works great out of the box!

Wondering if you could provide some guidance to extend this for User Relationships as well. Not looking for hand-holding, just a nudge in the right direction.

In any case, great work! :)

I’m still hoping for a response @Bazalt

Hey, sorry for the delay. Well, this would be a great idea for a future version of my add-on. Right now, I don’t know if this could be technically possible. I rarely use User fields in my projects. That would certainly require a certain amount of work to extend these features to User fields, but I keep the idea in mind. Thanks for your suggestion!

Any chance you’d be making either a similar add-on or adding functionality that rather than create a new post, that you can just submit a text field?

Basically, I want to have it be a relationship field, but if the one I want isn’t there, to create a text field to go in its place rather than create a new post.

I’m not sure I completely understood. Relationship fields expect to be set with posts. What the point with “text fields” ?

I guess its for moderators who can’t publish posts – let them select from relationship, but if they need a post called ‘blue’ for example, and there is no blue post, that they can type blue without creating a blue post.

If the results were in a list I guess.

Sorry, but that definitely won’t be developed. As I said, relationship fields are linked to posts. I won’t get around permissions: if moderators can’t create posts, there’s a reason for that.

Does it support ACF relationships in a repeater field?

Absolutely.

Yo. Thanks. I’m pumped to try this. Just bought and installed and still don’t see the option to set the ability to create on my existing relationship fields. Also tried adding the setting in the ACF json for the field – similar to your instructions for PHP above, but nothing.

I’m on Wordpress 4.9.1 and ACF Pro 5.6.7

Any ideas? I don’t see any errors in the console nor wp debug either.

Hi, I just tried with the same configuration as yours without noticing any issue. Could you give me an access to your site?

csvk

csvk Purchased

Dear,

i’ve found a bug in your plugin. When i try to add a object from input type “Post Object” then new published post isn’t added to relation. In fileds type “Relation” every thing works fine.

In Dev Tools there are errors, after i click Publish>

VM4429 onloadwff.js:64:

Uncaught TypeError: l.toLowerCase is not a function at should_fill_on_click (onloadwff.js:64) at onloadwff.js:66

select2.full.min.js?ver=4.0:

The select2(‘data’) method was called on an element that is not using Select2.

select2.full.min.js?ver=4.0:3

Uncaught TypeError: Cannot read property ‘data’ of undefined

VM4735 load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,postbox,jquery-ui-position,jquery&load[]=-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,underscore,word-count,post,svg-painter,wp-auth-check,jquery-ui-dra&load[]=ggable,jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,shortcode,backbone,wp-util,wp-backbone,media-models,moxiejs,plup&load[]=load,wp-plupload&ver=4.9.1:299 Uncaught TypeError: Cannot read property ‘hasClass’ of undefined

csvk

csvk Purchased

I use your plugin in ver 2.2. My WP is 4.9.1. ACF PRO 5.6.7.

jwood01

jwood01 Purchased

Have been using this plugin for over a year happily!

We have moved all editing to the front end and intend to block access to the admin section of the site. When we do this it breaks the calls to the admin-forms.

Is there a way to call front end forms for post creation?

by
by
by
by
by
by