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

Remove unsupported 'count' argument from WP_Term_Query DocBlock #6770

Conversation

snehapatil2001
Copy link

@snehapatil2001 snehapatil2001 commented Jun 11, 2024

Ticket

https://core.trac.wordpress.org/ticket/61094

Description

  • This PR, which involves removing the unsupported count argument from the DocBlock of the WP_Term_Query::__construct method.
  • Currently, the DocBlock mentions the count argument, but it is not utilized in the WP_Term_Query::get_terms method. This leads to potential confusion for developers.

Changes Made

  • Removed the count argument description from the WP_Term_Query::__construct method's DocBlock.

Context

The WP_Term_Query class provides methods for querying terms in WordPress. The count argument was initially proposed but later removed from the code, while the DocBlock remained unchanged. This PR aligns the DocBlock with the actual code behaviour, ensuring clarity and consistency in the documentation.

Testing

  • Verified that the count argument description is removed from the WP_Term_Query::__construct DocBlock.
  • Tested the functionality of the WP_Term_Query class to ensure no regressions occurred.
  • Reviewed and verified the changes locally.

Copy link

github-actions bot commented Jun 11, 2024

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 snehapatil02, peterwilsoncc, tyrannous, jtsternberg.

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

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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • 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.

@tyrann0us
Copy link

Hi @snehapatil2001, the PR removes the count DocBlock parameter.
However, as I wrote in the Trac ticket description, wouldn't it make more sense to add support for it to achieve feature parity with other WP_*_Query classes?

Thanks!

@jtsternberg
Copy link

wouldn't it make more sense to add support for it to achieve feature parity with other WP_*_Query classes?

Isn't that what $fields['count'] is for?

* The return type varies depending on the value passed to `$args['fields']`.
*
* The following will result in an array of `WP_Term` objects being returned:
*
* - 'all'
* - 'all_with_object_id'
*
* The following will result in a numeric string being returned:
*
* - 'count'

Also, if we're removing the doc block, we should also remove from query_var_defaults:

@peterwilsoncc
Copy link
Contributor

Merged r59261 / 9de0f74

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.

4 participants