my_overwrite_settings function example not working
-
WordPress 4.9.9
ACF PRO 5 v5.7.13So far, the plugin works pretty great. It’s updating back and forth between two custom post types, an ACF Relationship field with the same name of ‘related_post’
When I try to employ the my_overwrite_settings() example function, it doesn’t delete the previous post. On one side of the transaction is essential a “blog post CPT*”, which has a one-to-one relationship with another “blog author CPT”. On the flipside, a “blog author CPT” will have a one-to-many relationship with the “blog post CPT”.
Is there something inherent in the fact that one side can only have one post relationship, while the other side can have many relationships? Is that why it’s not deleting the first “blog author CPT” if a new one is attached?
Other than that, this plugin seems to be working pretty great.
This is the code I’m using in my functions.php file.
add_filter('acf-post2post/overwrite-settings', 'my_overwrite_settings'); function my_overwrite_settings($settings) { $settings['related_post'] = array( 'overwrite' => true, 'type' => 'first' ); return $settings; }
(*note: CPT is shorthand for Custom Post Type, for brevity.)
- The topic ‘my_overwrite_settings function example not working’ is closed to new replies.