Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deleted posts from already attached list #42

Open
nadinezein opened this issue Jun 8, 2017 · 4 comments
Open

Removing deleted posts from already attached list #42

nadinezein opened this issue Jun 8, 2017 · 4 comments

Comments

@nadinezein
Copy link

Thank you for this great plugin.
I didn't find this but not sure if its similar to "bidirectional relationship".

Is there a way to exclude the posts that have been originally deleted from the already attached list, without needing to resave or remove them manually?

example:
We have the following posts: postA, postB, postC
Under Related Posts (using cmb2 attached posts) for postA I have saved postB and postC.
After doing so I delete postC in the future. Can postC be excluded from postA Related Posts both in the front and back end?

@claytoncollie
Copy link

+1 on this one. Draft would be good to remove from this list as well. Or at least have a filter to specify which type of post state you want to show on front and backend

@websitegenii
Copy link

I agree here, this is causing issues for a site we have. We have attached "Providers" to each Service page which is a lot of services pages. Though when removing them the saved data for this still includes the ID of the post type.

I think I can fix this by checking if it's empty in my own loop but ideally this data wouldn't be passed at all once the original post is deleted.

@tw2113
Copy link

tw2113 commented Jul 18, 2022

One of the big issues I can think of with this is knowing what other posts have a given ID saved as meta, so that it can be somehow removed. Otherwise, it's going to be a case of checking for every row in the postmeta database to try and find the ID, and also making sure that it's also a post that is actually using the intended meta key.

A lot of complexities the more I think about it.

@websitegenii
Copy link

websitegenii commented Jul 18, 2022

I've fixed our existing site for now by calling this field but when I loop through the ID's I am checking if it's publish status. This allows me to use continue; to skip the CPT that's not published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants