Giter Site home page Giter Site logo

acf-post2post's People

Contributors

andrewminion-luminfire avatar davidshq avatar hube2 avatar ruscon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acf-post2post's Issues

Order of Posts Not Preserved

Hi John, my client is experiencing an issue which I'm having difficulty finding a solution to.

We have a custom post type that can be joined via the relationship field to pages. Typically pages will have several of the CPT joined to them, and the CPT are sequenced within the relationship field on the page. I'm experiencing intermittent issues, where, when the act of saving the CPT (previously associated with a page) will cause the sequence on the joined page to change. The CPT that's been saved, will be moved from wherever it had originally been to the end.

The relationship fields are not nested and I have no quantity limits imposed. Do you have any recommendations for debugging this scenario?

Thank you for your time, and thank you for the great plugin.

Update relationship after post delete

I encountered an issue when deleting a post by the method wp_delete_post(POST_ID). The related posts do not get updated. In other words: once a post is deleted the relationship field does not get updated until a manual save action is triggered in the WP Admin area.

Context: I have two post types (products and productBundles). A productBundle is linked to multiple Products. A Product might be linked to multiple productBundles. When a product is deleted by using wp_delete_post(productID) the productBundle still keeps a reference to the deleted product. When saving the productBundle in the WP backend the reference is updated.

How can I trigger an automated update of the related productBundle?

Hint: already tried triggering wp_save_post_revision(relatedProductBundleId), did not work :(

v1.2.6 problem – white screen on save

Hi! One bug it seems appeared in the version 1.2.6.

When I save a post containing relationship fields a bunch of warnings appears on a white screen:

 Warning: strval() expects exactly 1 parameter, 2 given in ***/wp-content/plugins/post-2-post-for-acf/acf-post2post.php on line 192
<same line many times>...
 Warning: Cannot modify header information - headers already sent by (output started at ***/wp-content/plugins/post-2-post-for-acf/acf-post2post.php:192) in ***/wp-includes/pluggable.php on line 1179

This doesn't happen with post types/pages that do not have any relationship fields attached. The relationship itself (and the post data) gets saved.

Thanks!

Bi-directional post type to media / media to post type

Hi,

I just figured it out that on my website only the bi-directional function work on post type to post type, but when it comes to "post type to media" and "media to post type", it stopped working.

I have a custom post type called "Work" which I link to an "image" from the media library or the other way around. At the moment I can't get both media and post type to work together.

dont quite understand this plugin

Is it possible that you could give an example of use?
I have a custom field "magician" in woo commerce product CPT.
Then i created a custom field "magician" in CPT "magician".
Then i think i created the relationship.
i dont see anything.

What i was wanting to do was have a custom field on the woo product page with magician (url), so when you click the magicians name on the product page, it takes you to a page with other products for sale by that magician.

Is this possible with this plugin?

Filter options in relationship?

Hey John! Great work here. Question for you - I have a relationship set up between companies and jobs. The field shows open jobs when looking at the company page, and the company on the job listing. It works great.

Companies are CPTs, and I'm allowing submission of jobs. I only want users to be able to post jobs to companies that they "own" (are the authors of). Is there a way I can filter that list CPTs that appears in the relationship field in that fashion?

Thanks!

ACF upgraded to v6

Hi, ACF is upgraded to v6 could you please add support for that :-) thnx!

related post overwriting

When adding a relationship overwrites a value in the related post then the related post to the related post that is being removed should also be updated to remove the relationships.

Are we confused yet?

Super Helpful - Note on Documentation

Thanks for creating this. It's super helpful!

One suggestion on the documentation... You might mention that the plugin, once activated, uses the existing Relationship field to be bi-directional. Happily, it does not create a new field like a lot of other ACF plugins do.

Overwrite post object fields

Currently, if a post object field that only allows one selections is used and the related post already has an existing relationship that relationship will not be overwritten.

Example you are editing "Post X" and you choose "Post Y" as the related post but "Post Y" already has "Post Z" set in the relationship field then the field on "Post Y" will not be updated to "Post X".

Does anyone have any input on this?

I'm thinking about adding some type of filter/hook that will allow this behavior to be altered but I'm not exactly sure how it should work. I have some thoughts on it but thought I'd see if anyone has any input first.

Relationship field gets emptied when using 'Preview' of a post

Hi!
I have a hard time to reproduce this bug. We have a 1to1 relationship between a post and a custom typ post. It works correctly, so that when one side saves/updates/deletes the relationship, it gets updated inside the other post. So far so good 👍

But when saving and previewing the post a few times the relationship field in the backend (and so the database) will get emptied and the relationship is deleted. Most times it will happen when we have post already written and saved (published or outstanding doesnt matter) and the use the 'Preview' button of Wordpress. Not every time, but sometimes.

I tried to debug the saving process somehow, but cannot find out how and where this could happen or fail 🤷‍♀️

Any ideas what could be buggy or goes wrong?

Fields have the same name, both are top level and not nested inside repeaters/flexibles. Latest WP, latest ACF, latest P2P. Just using this filter to overwrite values because we only use one (from the docs):

add_filter('acf-post2post/overwrite-settings', function($settings) {
  $settings['product_test_relationship'] = [
    'overwrite' => true,
    'type' => 'first'
  ];
  return $settings;
});```

Reciprocal relationships not set when creating post through API or webhook.

Hi there! Firstly, thank you so much for this plugin. Helps a ton!
The plugin works perfectly when using the WP Admin GUI.

However, when creating a post through the API, and setting the values of the relationships to the relevant post-ids, the relationships only show up in the created post, and not the related posts. Same result when using forms (Gravity), Zapier or Integromat to create posts.

Is there a way to trigger the function to run after new post creation through the API?

Multiple customs posts type and function add_local_field_groups

Hi,

In the past I have used the plugin with Object Post. This time I had to do it in another way.

I have 3 customs posts types:

  • Exhibition
  • Work
  • Artist

Those 3 posts types have sometimes 2 or 3 relationship field which link them to either Exhibition, Work or Artist custom post type content.

First of all I've created the field with the ACF UI, I made sure to use same "name" for the relationship field. For example:

exhibition_acf
work_acf
artist_acf

Then in a new WordPress install, I used the function "add_local_field_groups" in my functions.php. It seems to work without problems, since the field are showing up and save the data.

The problem is, as you might have expected, they don't sync between them.

Do you know why? I have tried first without the plugin with the DOC, found here: https://www.advancedcustomfields.com/resources/bidirectional-relationships/

Then your recommandation found here (also tried the GitHub link provided - maybe I didn't do it correctly):
https://support.advancedcustomfields.com/forums/topic/bidirectional-relationships-not-updating-both-sides/

User Field

I know its a little different, but it is close enough in concept I figured I'd ask. Do you have any plans to include the "User" field in any future updates? For instance allowing users to easily be assigned to other users (A "Manager" role who is assigned "Employee" roles - so the Manager would have multiple employees and the Employees would only have one manager)

Bi-directional relationship for all selected posts?

Would something like this be possible?

https://support.advancedcustomfields.com/forums/topic/bidirectional-relationship-for-selected-posts/


Example with the current function:
Current Post: Post 1
Related Posts: Post 2, Post 3, Post 4, Post 5

Post 2
Related Posts: Post 1


Post 5
Related Posts: Post 1

Example with what I’d like it to do:
Current Post: Post 1
Related Posts: Post 2, Post 3, Post 4, Post 5

Post 2
Related Posts: Post 1, Post 3, Post 4, Post 5


Post 5
Related Posts: Post 1, Post 2, Post 3, Post 4

Stopped working?

It looks like this has stopped working. Is this not working for others?

+ Signs in Title

Hi, I import 2 Post types via WP-All import. Both have a field, that syncs with acf post2post. Problem is:
There is a custom post with title "MTV+ HD". When imported it syncs with the also present title "MTV HD" instead of "MTV+ HD". Same happens for "Sport1+ HD"
When I add the connection in the relationship field manually it works fine.
Could this be because of the seriailzation functions? I guess the + sign is stripped out.

Example of the RAW import of the relationship field:
13th Street HD|A&E|Animal Planet HD|auto motor und sport channel|AXN HD|BonGusto|Discovery Channel HD|E! Entertainment|Eurosport 2|Fix&Foxi|FOX HD|Fuel TV HD|Gute Laune TV|Heimatkanal|HISTORY|KinoweltTV|Marco Polo TV|Mezzo Live HD|MTV LIVE HD|NATIONAL GEOGRAPHIC HD|Nick Jr.|Penthouse HD|ProSieben FUN HD|Romance TV|Silverline TV|SONY CHANNEL HD|SPIEGEL TV Wissen HD|sportdigital HD|SYFY HD|wetter.com TV|Playboy TV|ducktv|SPORT1+ HD

Any idea how to fix this?

Thanks Sascha

Direction Clarification

Could you elaborate on how to accomplish bidirectional post/relation fields. Perhaps supply an example or better steps?

If I could get this working, it would be amazing!

PS- Thank you for the hard work

Can't activate plug-in

This beautiful little plugin is exactly the bidirectionally relationship solution I've been seeking.

I'm on a multisite network and can't get the plug-in to activate. When i click activate on one of the multisite plugin screen, I get an "Plugin activated." message but the plug-in listing doesn't change state. It still says "Activate" and it's functionality doesn't seem to be working.

Same happens if I try to network activate it.

Make installable via composer?

Hi, thanks for the useful plugin.

Would it be possible to make it available via Packagist repository (or in some other way)? I use this method to make ACF itself installable with Composer.

Thanks!

bi-directionally sync after post import

Hey John, I love your plugin. It's great tool.

For a musican website I am currently trying to link two CPT named tours and dates via CSV import.

I'm using the WP All Import plugin right now and I notice that the posts are not bi-directionally linked after the import.
After date posts import the field "tours" is perfectly linked with existing tours. But when I look at the tour post, the dates aren't selected/linked. Only when I update a date post, then everything is fine and bi-directionally linked.
Do you have experience with importing or how I could trigger your plugin to updating?

Plugin name issue

There is an issue with the plugin name. When this plugin was added to the WP repo the name created there was "post-2-post-for-acf". This was not an issue until recently. However, it seems that now when updating the version here on GitHub is always used. This causes the folder name of the installed plugin to be changed if it was originally installed from WP. This folder name change causes the plugin to be deactivated after it is updated.

To fix this issue I will need to rename the plugin here on GitHub to match the plugin name on WP.

This is a heads up for anyone that originally installed the plugin from GitHub because updating the plugin after the change will cause the same effect for those users after I make the change.

I will be changing the plugin name here in the next week or so.

User/Term relationships

Look at possibility of adding additional relationship fields like user and taxonomy fields.

Ordering for Newly Created Relationships?

Thanks for this great plugin. It's been an answer to my prayers.

I have two post types. Products and Groups. When editing a product I use the Post Object field to assign the product to a group. When I edit the group there's a relationship field where I can see all the products related to the group. Any products assigned a group from the product edit screen are added to the end of the list of the relationship field within the group edit screen. Can I change that somehow so that products assigned to a group are added to the beginning of the group relationship list?

One to many relationship issue

There is an issue using acf-post2post with one-to-many relationships.

I have a custom post type subproject, which can have many apartment's.
Both have a custom field with name subproject_apartments_relationship.
The custom field type for subproject is a relationship since it can have many apartments. The custom field type for apartment is post_object since it has only one subproject.

Let's say there are two subprojects, "subproject-A" and "subproject-B".

Say "apartment-1" is currently linked to "subproject-A". In the "subproject-B" post, I add "apartment-1". After checking "aparment-1", the relationship field shows "subproject-B". So far so good. But when I take a look at the "subproject-A" post, it still shows "apartment-1".

Starting situation

  • apartment-1 has subproject-A
  • subproject-A has apartment-1
  • subproject-B has no apartments

Change subproject to "subproject-B" from within the "apartment-1" post

  • apartment-1 has subproject-B
  • subproject-A has no apartments
  • subproject-B has apartment-1

Back to starting situation, add "apartment-1" in the "subproject-B" post

  • apartment-1 has subproject-B
  • subproject-A has apartment-1 ---> this is not what I expect
  • subproject-B has apartment-1

Please help!

Add support for linking across Multisite posts

It would be excellent to be able to relate posts in a bidirectional way between multisites.

This would be primarily for linking multisite content from different languages e.g:

Multisite 1 - Page: Home En-US - [english]
Multisite 2 - Page: Home ES-ES - [spanish]

A bi-directional relationship to link the two together.

Is this something that could be introduced as core or an add-on extenstion?

post2post 1.3.2 stopped working

Hi,

For some reason two days ago after I made available updates post2post stopped working. It isn't writing values bidirectional as It should, it's just reading what was saved till now in ACF.

Current WP version 4.9.9
No Gutenberg plugin
ACF Post-2-Post 1.3.2
Advanced Custom Fields PRO 5.7.11

Could you verify the situation, please? Otherwise what can I do to repair the issue? It's on a production site that is using post2post as a core function during uploading content, so It's a quite big issue for us.

Thank you very much

Relationship field setup question

How would I set up the following relationships using P2P?......As you can see, the same relationship fields get used several times in each scenario, Since Home Listings, Communities, Model Homes and Sales Managers share CPTs that relate with one another. In the scenario below, the Select Related Community on the Home Listing Post keeps getting erased when I save the page. All the other fields are working. Can you please, pretty please, with sugar on top outline below for each group what I should name the custom fields so that it works properly??????? I've tried working with this for two months and I'm at my wits end. I've now deleted several ACF fields when issues arise in my testing which annoys me because they aren't technically removed in the database, sigh.

ON HOME LISTING POST » ADMINS CAN SELECT A RELATED COMMUNITY
Home Listing Post - Select Related Community

ON COMMUNITY POST » ADMINS CAN SELECT A RELATED HOME LISTING
Community Post - Select Related Home Listing

ON SALES MANAGER POST » ADMINS CAN SELECT A RELATED COMMUNITY
Sales Manager Post - Select Related Community

ON COMMUNITY POST » ADMINS CAN SELECT A RELATED SALES MANAGER
Community Post - Select Related Sales Manager

ON HOME LISTING POST » ADMINS CAN SELECT A RELATED SALES MANAGER
Home Listing Post » Select Related Sales Manager

ON SALES MANAGER POST » ADMINS CAN SELECT A RELATED HOME LISTING
Sales Manager Post - Select Related Home Listing

ON MODEL HOMES POST » ADMINS CAN SELECT A RELATED HOME LISTING
Model Homes Post - Select Related Home Listing

ON HOME LISTING POST » ADMINS CAN SELECT A RELATED MODEL HOME
Home Listing Post - Select Related Model Home

Thanks for your help in advance!

Insert new relationships at the top

Hi @ruscon, thanks for your work with this plugin!

I'm trying to get the new relationships added on top of the opposite extreme. Example:

If my CPT 1 has these crosslinks

  • Post 1
  • Post 2
  • Post 3

And I add from Post 4 a relationship with CPT 1, I hope the list of relationships is

  • Post 4
  • Post 1
  • Post 2
  • Post 3

In order to more easily identify those that have not yet been assigned a manual order. I tried the options that are available but the closest thing is to overwrite the first value and it is not what I am looking for.

I wonder if it is possible to add a filter here, so to switch between append (default) and prepend globally and then use $value[] or array_unshift as appropriate.

Do you think it's possible? Glad to send a PR in that case.
Thanks

possible caching issue when multiple relationship fields are used

There is a possible problem when there is more than one relationship field on the related post_id. This is because the field returned is cached. This should only be a problem when there are multiple relationship fields between the same post types. This needs to be tested.

Multiple bi-directional relationships

Is it possible to have multiple bi-directional relationships?

E.g.

CPT1 <---> CPT2
CPT1 <---> CPT3
CPT2 <---> CPT3

CPT4 <---> CPT5

Would each pairing need its own ACF field group? E.g.
connected_items_1_2
connected_items_1_3
connected_items_2_3
connected_items_4_5

which would result in 10 groups (one for each direction)

Or is it possible to just have:

connected_items_1
connected_items_2
connected_items_3
connected_items_4
connected_items_5

?

Thanks in advance :-)

Activate the plugin only for specific field

Instead of excluding fields one by one using the filter:
add_filter('acf/post2post/update_relationships/key=field_XXXXXXXX', '__return_false');

It's possible to disable all the relationship fields and enable only the field that i want?

In my experience there are few times when it is needed to enable a bidirectional relationship between fields, and in this way if I add in the future a new relationship field which doesn't need a bidirectional relationship I don't have to edit my code and exclude that field.

A problem with serialization

Hi!

I'm not sure if it's a problem related to the plugin or ACF itself. When post2post saves the current post id to the DB postmeta of the post it's being related to, it seems that in the serialized data the post id is not always surrounded by quotes. That makes it harder to do LIKE-based reverse queries described in the ACF documentation, which tells us to surround the related post id with quote marks to avoid intersections with other ids.

A dirty workaround of mine for now is to use second meta query which checks also for : and ; around the id.

Are exceptions enabled ?

Hi,
Is this possible to have exceptions ?
I mean I have some Relationship fields which I need them to be bidirectional, using your plugin, and I have some Relationship fields I'd like to keep them unidirectional.
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.