Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

title property is missing from WP_Query class documentation #1371

Closed
jessedyck opened this issue Nov 19, 2023 · 6 comments
Closed

title property is missing from WP_Query class documentation #1371

jessedyck opened this issue Nov 19, 2023 · 6 comments
Assignees
Labels
code reference Issues for Code Reference portal of DevHub developer documentation (DevHub) Improvements or additions to developer documentation self-assigned [Status] Done Issue is completed

Comments

@jessedyck
Copy link

Issue Description

The documentation for the WP_Query class is missing the title parameter.

URL of the Page with the Issue

https://developer.wordpress.org/reference/classes/wp_query/

Section of Page with the issue

I think this would best fit under the "Post & Page Parameters" section.

Why is this a problem?

WordPress 4.4 added the parameter to WP_Query to retrieve posts by their title (post_title), however it is not currently in the documentation for the class. It's especially note-worthy that the parameter is title and not post_title, and also that it must be an exact match (the generated SQL clause uses equals, for example: 'post_title' = 'Hello World!')

Code where this parameter is applied: https://github.com/WordPress/wordpress-develop/blob/6.4/src/wp-includes/class-wp-query.php#L2134

Suggested Fix

In the "Post & Page Parameters" section, at the end of the ul we can add:

  • title (string) – use post title. Retrieve posts by post_title (available since version 4.4).

Then we can add an example, within the same section:

Display posts with a specific title:

$query = new WP_Query( array( 'title' => 'Hello World!' ) );

Note the title must be an exact match.

@jessedyck jessedyck added the [Status] To do Issue marked as Todo label Nov 19, 2023
Copy link

Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.

@stevenlinx stevenlinx self-assigned this Dec 21, 2023
@github-actions github-actions bot added [Status] In progress Issue is in progress and removed [Status] To do Issue marked as Todo labels Dec 21, 2023
@stevenlinx stevenlinx added code reference Issues for Code Reference portal of DevHub [Status] To do Issue marked as Todo and removed [Status] In progress Issue is in progress labels Dec 21, 2023
@github-actions github-actions bot added the developer documentation (DevHub) Improvements or additions to developer documentation label Dec 21, 2023
Copy link

Heads up @stevenlinx - the "code reference" label was applied to this issue.

@isheeba
Copy link

isheeba commented Mar 12, 2024

/assign

Copy link

Hey @isheeba, thanks for your interest in this issue! 🍪🍪🍪
If you have any questions, do not hesitate to ask them in our #docs Slack channel.
Enjoy and happy contributing ❤️

@stevenlinx stevenlinx assigned stevenlinx and unassigned isheeba May 7, 2024
@github-actions github-actions bot added [Status] In progress Issue is in progress and removed [Status] To do Issue marked as Todo labels May 7, 2024
@stevenlinx
Copy link
Member

I've made the revisions.

@stevenlinx stevenlinx added [Status] Review Issue in review and removed [Status] In progress Issue is in progress labels May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Heads up @docs-reviewers - the "[Status] Review" label was applied to this issue.

@github-actions github-actions bot added [Status] Done Issue is completed and removed [Status] Review Issue in review labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code reference Issues for Code Reference portal of DevHub developer documentation (DevHub) Improvements or additions to developer documentation self-assigned [Status] Done Issue is completed
Projects
None yet
Development

No branches or pull requests

3 participants