-
Notifications
You must be signed in to change notification settings - Fork 975
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
Allow wp post term *
to support Term IDs
#3716
Comments
Thanks for the suggestion, @pkarjala.
Historically, the challenge with supporting both slugs and ids is that a term can have a numeric slug. As such, if I have a term with id Here are some prior threads:
Thoughts? |
One option, as previously suggested, may be to set a flag that indicates ONLY usage of Term IDs versus Slugs. In that instance, the user MUST provide only numeric Term IDs; otherwise it is presumed that they are providing a Slug (which may also be a numeric string value). I'm not familiar enough with other flag settings in the
|
Do you think it's necessary to add this feature? How did you end up solving the problem in your case? |
We used
to pull a list of all Terms associated with a specific Taxonomy (document_type in this case), and their associated IDs and Slugs. We then process this in PHP to create a list of Slugs which we use for comparison against the existing list of Term IDs that we have from a spreadsheet. The Name is included to make sure we have the correct IDs and Slugs. It would be more convenient and faster programmatically for us to be able to use the Term IDs directly instead of having to do a lookup comparison for each Term ID, but it is not strictly necessary. |
This makes sense. I'm amenable to adding a |
Currently if you want to set the Terms associated with a Post via wp-cli, you have to use the Slug of the Term. This is somewhat cumbersome if there are a large number of Terms to set, and the ID of said Term is already known, as the Slug must be programmatically looked up and then the ID translated to that Slug.
Instead, allow the option of passing an array or list of Term IDs to the
wp post term *
command list.See https://codex.wordpress.org/Function_Reference/wp_set_post_terms for documentation on using IDs in
wp_set_post_terms
.The text was updated successfully, but these errors were encountered: