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

Posts from different post types don't show on the Add Post meta box #56

Closed
lmartins opened this issue Apr 2, 2017 · 4 comments
Closed

Comments

@lmartins
Copy link

lmartins commented Apr 2, 2017

Hi,

First and foremost thank you for this extremely useful plugin.
I've testing out to start using on my WP projects but I've noticed a subtle but significant problem.

Im testing Stream Manager to populate a few post lists on a homepage, where there multiple zones with contents from different post types. In most cases each zone is populated with contents from a single CPT, meaning that I use the provided filters quite a lot:

add_filter('stream-manager/options/id=420', function( $defaults ) {
    $defaults['query'] = array_merge($defaults['query'], array(
		'post_type' => 'page',
		'posts_per_page' => 8,
		'meta_query' => array(
	        array(
	         'key' => '_thumbnail_id',
	         'compare' => 'EXISTS'
	        ),
	    )
	));
    return $defaults;
});

In this particular example I'm excluding posts that do not have a featured image, but the issue I'm describing next happens with or without that parameter.

The problem quite simply is that when I try to use the Add Post meta box two things happen:

  1. It still suggests posts for this stream, even though the stream is configured to only accept pages
  2. It won't suggest any page, no matter exists or not pages that would meet the criteria above.

Anything I can do to avoid this?

@lggorman
Copy link
Contributor

lggorman commented Apr 3, 2017

Hey @lmartins, thanks for logging this. Looks like the search suggestions are being powered by a more generic query, whereas the expected behavior would be for them to have the same filter applied to the stream itself, like you described. So your setup is correct -- the problem is on the plugin side. I'm taking a look now to see if there's a simple resolution, will keep you updated.

@lmartins
Copy link
Author

lmartins commented Apr 3, 2017

@lggorman thanks so much for the feedback Linda.

lggorman added a commit that referenced this issue Apr 6, 2017
#56 Apply filters to 'Add Post' search results
@lggorman
Copy link
Contributor

lggorman commented Apr 6, 2017

@lmartins I believe this should be resolved by #57. When you get the chance pull the latest (or upgrade from the wp plugin repo) and let me know if the Add Posts search is now working as expected.

@lmartins
Copy link
Author

lmartins commented Apr 6, 2017

@lggorman I think so Linda, seems to be working beautifully now. Thank you for the update :)

@lmartins lmartins closed this as completed Apr 6, 2017
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