Comments (4)
This could have something to do with where and when you are adding the field groups in PHP.
In what file is your code?
When is it executed? Are you using a specific hook?
from acf-post2post.
The field groups in PHP are in a file called bones.php which is directly called in the beginning of my functions.php
So in the bones.php I have all the functions hook. For the ACF field group I have this:
function my_acf_add_local_field_groups() {
if( function_exists('acf_add_local_field_group') ):
…
endif;
}
After that, in my functions.php I called the file containing my hooks:
require_once( 'library/bones.php' );
After the require_once, I have this function:
function rt_launch() {
require_once( 'library/custom-post-type.php' );
// launching operation cleanup
add_action( 'init', 'rt_head_cleanup' );
// A better title
add_filter( 'wp_title', 'rw_title', 10, 3 );
// remove WP version from RSS
add_filter( 'the_generator', 'rt_rss_version' );
// remove pesky injected css for recent comments widget
add_filter( 'wp_head', 'rt_remove_wp_widget_recent_comments_style', 1 );
// clean up comment styles in the head
add_action( 'wp_head', 'rt_remove_recent_comments_style', 1 );
// clean up gallery output in wp
add_filter( 'gallery_style', 'rt_gallery_style' );
// Init ACF
add_action('acf/init', 'my_acf_add_local_field_groups');
}
add_action( 'after_setup_theme', 'rt_launch' );
Below that group, there is other functions as such as:
add_image_size
update_option
(size of some thumbnails)
$wp_customize->remove_section
—
Basically it's called after_setup_theme, as the hook is in my rt_launch function. What do you think?
from acf-post2post.
this is how it appears to me
On the Exhibition post type you have a relationship field name "artist_related", but on the Artist page you ave a field named "exhibition_related". If these two fields need to be bidirectional with each other then they are not named the same.
Exhibition and Work share a field named "artist_related", these two fields will be bidirectional. I don't think this is what you had in mind.
This means that selecting an "Artist" when updating a "Exhibition" the artist will not be updated because it does not share a commonly name field on the artist post type.
When I create fields to use with this plugin I try to name them using the post types that will be related.
for example, looking at your field setup you need 4 fields (7 actually counting the fields for each post type):
exhibition_to_work (used on the exhibition and work post types)
exhibition_to_artist (used on the exhibition and artist post types)
work_to_artist (used on the work and artist post types)
work_to_work (uses only on the work post type)
Sorry, I should have seen that in the OP. I didn't look at the fields you set up as carefully as I should have.
from acf-post2post.
I took your comments in account and renamed the field accordingly. And now it works both ways!
You were right, I was a bit confused on how to use the field name for the relationship, but it's quite clear now.
Thank you for your help!
from acf-post2post.
Related Issues (20)
- User/Term relationships HOT 4
- Stopped working? HOT 1
- Bi-directional post type to media / media to post type HOT 5
- post2post 1.3.2 stopped working HOT 3
- + Signs in Title HOT 2
- Add support for linking across Multisite posts HOT 1
- One to many relationship issue HOT 9
- Bi-directional relationship for all selected posts? HOT 3
- Ordering for Newly Created Relationships? HOT 1
- expand overwrite settings to allow both field name and field key
- Plugin name issue HOT 1
- Update relationship after post delete HOT 6
- Insert new relationships at the top HOT 3
- Relationship field gets emptied when using 'Preview' of a post HOT 3
- Activate the plugin only for specific field HOT 2
- Reciprocal relationships not set when creating post through API or webhook. HOT 1
- dont quite understand this plugin HOT 2
- ACF upgraded to v6 HOT 1
- Relationship field setup question HOT 17
- Bidirectional Fields ACF Extended HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf-post2post.