Timeline for Exclude sub category posts from category display
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 16 at 7:28 | comment | added | vee |
pre_get_posts is action hook not filter hook. So, it should be add_action() without return anything because $query argument is pass by reference.
|
|
Mar 8, 2014 at 0:05 | comment | added | Steve | I just added a new post to Conferences, and it doesn't show in the News category page, so it looks like your fix is working for new posts, but not for posts which used to be in the News category, but were moved into separate subcategories. | |
Mar 4, 2014 at 14:20 | comment | added | 1fixdotio | @Steve I created a child theme for twentytwelve and paste my code in functions.php, it worked well. Could you disable the plugins like jetpack and try again? | |
Mar 4, 2014 at 11:33 | comment | added | Steve | No errors. I've uploaded the updated code and it is still not working. My theme is a child theme of Twenty Twelve. See this page which contains "2012 WA Men’s Shed Conference Presentations" & "The Warbler – WA Men’s Shed newsletter". These two are not in the parent category. | |
Mar 3, 2014 at 14:53 | comment | added | 1fixdotio | @Steve I've tested the code and it could work on my server. Just updated the code a bit, hope that helps. | |
Mar 3, 2014 at 14:51 | history | edited | 1fixdotio | CC BY-SA 3.0 |
Get category from queried_object
|
Mar 3, 2014 at 14:34 | comment | added | 1fixdotio | Did you get any error messages? May I know did you enable the permalink? | |
Mar 3, 2014 at 13:07 | comment | added | Steve | Hi @1fixdotio. Thanks for helping out. I added this to my child theme's functions.php, but the subcategory posts still display in the parent category. | |
Mar 2, 2014 at 11:24 | history | answered | 1fixdotio | CC BY-SA 3.0 |