docs: add missing null to $post param types#10938
docs: add missing null to $post param types#10938apermo wants to merge 1 commit intoWordPress:trunkfrom
Conversation
Add null to @param type for $post in functions where the signature defaults to null. Reorder wp_force_plain_post_permalink to int|WP_Post|null for consistency.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Several functions across core accept
nullas a valid value for their$postparameter ($post = nullin the function signature), but the@paramtype annotation does not includenull.This patch adds
nullto the@paramtype for all affected functions across 9 files, and reorderswp_force_plain_post_permalink()fromWP_Post|int|nullto the conventionalint|WP_Post|null.Changes
get_the_date,get_the_modified_date,get_the_time,get_post_time,get_post_datetime,get_the_modified_time,get_post_modified_time,get_post_timestamp_get_comment_reply_idget_post_embed_url,get_post_embed_htmlget_post_mime_typeget_the_excerpt,post_class,get_post_class,get_page_template_slughas_category,has_tag,has_term_update_posts_count_on_transition_post_statusdisplay_media_statewp_force_plain_post_permalink(type reorder)Trac ticket: https://core.trac.wordpress.org/ticket/64645
Use of AI Tools
Used Claude Code to identify all locations of the missing phpdoc and to help with summarizing the changes. Every change was monitored and reviewed by myself before opening the PR.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.