Repository navigation
fix(academy): show posts of any date on the Content Board - #1114
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The PublishPress Content Board only lists posts whose publish date falls inside its date range. That range defaults to five weeks either side of today, and it applies even when no date filter is set (
posts_where_range()inpublishpress-planner/modules/content-board/content-board.php).The board tracks workflow status, but a session's publish date is when its post was created. As a result:
Fix
A new mu-plugin,
cbf-content-board-all-dates.php, removes the date condition from the board's query:PP_Content_Board_posts_query_args, which receives the range as its fourth argument.posts_wherefilter at priority 11, after PublishPress's own, removes the exact condition PublishPress built from that range.Only queries tagged by the board are touched. If PublishPress changes how it writes the condition, nothing matches and the board keeps filtering by date as it does now.
The plugin builds the dates with
gmdate()where PublishPress usesdate(). They give the same result because WordPress sets PHP's default timezone to UTC.The board's date filter controls stay in place but no longer narrow the list.
Testing
I ran the board's query on production with the live
PP_Content_Boardinstance and itsposts_where_range(). I set the date range in memory to 5 November to 31 December 2026, so nothing was saved to user meta:post_datecondition.post_datecondition.WP_Queryis unchanged.phpcspasses.