Closed jcollin closed 14 years ago
The value for exclude_from_search should only be null (empty) if you want to default to the internal argument, which in the defaults based on the public, private, and protected args.
I'm not seeing anything wrong with the way this is set, except that it does pass in '1' instead of true when set, but that isn't breaking anything at this point.
if I select "no" in the admin form for exclude_from_search, the search give no results from my content of post type. I see in the engine search of wordpress, only a empty value for exclude_from_search give the result with the content of post type.
I am seeing the same behavior as jcollin. I noticed that when you select "no" in the admin it sets the value to 0. exclude_from_search requires a boolean value and it does not seem to be responding (i.e. setting the values as expected in the register_post_type() call) to the no value of 0. If there are strict comparisons along the way in Wordpress this could explain this behavior.
To fix this problem, I just explicitly casted the integer values (passed in by the admin form) to booleans in all the get functions in dynamic-content.php, then wordpress seemed to respond to this.
So for example, on line 118:
return $this->get_setting('exclude_from_search', false);
I changed it to:
return (bool) $this->get_setting('exclude_from_search', false);
Just a note: this problem still persists in version 0.17 for custom content types and the exclude_from_search parameter. You can apply the boolean casting to line 122 in dynamic-content.php to get it to work.
Thanks for that. I fixed it in 2440310, but it looks like it got overwritten in my next commit. I must have screwed up the merge.
For Wordpress search in a post type generated by CMS Press, the value of exclude_from_search must be empty and not 0.