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

Initialising a PostCollection with an array can cause issues #46

Open
maikelRAOW opened this issue Jul 20, 2021 · 3 comments
Open

Initialising a PostCollection with an array can cause issues #46

maikelRAOW opened this issue Jul 20, 2021 · 3 comments

Comments

@maikelRAOW
Copy link
Contributor

It is currently possible to create a PostCollection with an array of PostModels. However, this will cause issues if a plugin attempts to call the getQuery Method. Query is only set if a PostCollection is created with a WP_Query.

@maikelRAOW maikelRAOW changed the title Initialising a PostCollection with an array Initialising a PostCollection with an array can cause issues Jul 20, 2021
@ChrisRAoW
Copy link
Contributor

@maikelRAOW I do not think it this is something that can or should be "solved". What do you think?

@maikelRAOW
Copy link
Contributor Author

maikelRAOW commented Nov 12, 2021

@ChrisRAoW You could generate a query that selects all the IDS of the posts that are currently in the collection.
$this->query = new WP_Query('post_type' => $type, ‘post__in' => $ids);

@ChrisRAoW
Copy link
Contributor

@maikelRAOW Mhh interesting.....could work indeed.

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

2 participants