Working version of the code from @roflman79.
/**
* Exclude current post/page from relationship field results
*/
// 1. Add the name=[NAME_OF_RELATIONSHIP_FIELD].
add_filter('acf/fields/relationship/query/name=[NAME_OF_REALTIONSHIP_FIELD]', 'exclude_id', 10, 3);
// 2. Add the $field and $post arguments.
function exclude_id ( $args, $field, $post ) {
//3. $post argument passed in from the query hook is the $post->ID.
$args['post__not_in'] = array( $post );
return $args;
}
Ahh, I see what you’re trying to do. I’ve never done it, and can’t answer your question. But I did find something that might steer you in the right direction.
This looks like a good start:
http://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/
Then this answers the first question I had looking at the example:
http://support.advancedcustomfields.com/forums/topic/front-end-creat-post-2/
As far as the repeater goes, it’s pretty awesome and it took me a bit to wrap my head around at first. It’s basically a group of fields that a user can keep adding new instances of.
I hope this helps and good luck.
Can you give more details about what you mean by “publish to my custom post type from the front end”? Are you accepting input from the front end to create custom posts?
Can you post the code that is generating your form?
What type of fields do you want to add to the form and what fields are already on the form?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.