Skip to content

docs: add missing null to $post param types#10938

Closed
apermo wants to merge 1 commit intoWordPress:trunkfrom
apermo:trac-64645
Closed

docs: add missing null to $post param types#10938
apermo wants to merge 1 commit intoWordPress:trunkfrom
apermo:trac-64645

Conversation

@apermo
Copy link

@apermo apermo commented Feb 15, 2026

Several functions across core accept null as a valid value for their $post parameter ($post = null in the function signature), but the @param type annotation does not include null.

This patch adds null to the @param type for all affected functions across 9 files, and reorders wp_force_plain_post_permalink() from WP_Post|int|null to the conventional int|WP_Post|null.

Changes

  • general-template.php: 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
  • comment-template.php: _get_comment_reply_id
  • embed.php: get_post_embed_url, get_post_embed_html
  • post.php: get_post_mime_type
  • post-template.php: get_the_excerpt, post_class, get_post_class, get_page_template_slug
  • category-template.php: has_category, has_tag, has_term
  • ms-blogs.php: _update_posts_count_on_transition_post_status
  • class-wp-widget-media.php: display_media_state
  • link-template.php: wp_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.

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.
@github-actions
Copy link

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props apermo.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61649
GitHub commit: eef6fb2

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Feb 15, 2026
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

Successfully merging this pull request may close these issues.

1 participant