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

#62997 Remove support for shared terms #8371

Draft
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

johnbillion
Copy link
Member

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.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnbillion This mostly looks good to me, and I'm in favor of this cleanup. Just a few points of feedback.

}

/**
* Splits a batch of shared taxonomy terms.
*
* @since 4.3.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
function _wp_batch_split_terms() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keep these functions around as empty? (This feedback applies to all similarly treated functions in this file.)

If this is about backward compatibility, I'd argue it's not worth it here for a few reasons:

  • This PR already breaks backward compatibility and (rightfully) prevents updates in case the site still needs the functionality.
  • These functions are marked private, so they should never be used externally in the first place.

At the very minimum, if we keep them, I think they should be marked deprecated and moved to deprecated.php. But per the above, I think it's really not worth keeping them. We should have a dev note for this change, and there we could also mention that all the private helper functions are being removed.

@@ -4572,14 +4299,7 @@ function _wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_
* @return array Array of new term IDs, keyed by taxonomy.
*/
function wp_get_split_terms( $old_term_id ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions are not marked private, so unlike the underscore prefixed ones above, I think these ones it would make sense to formally mark deprecated and move to deprecated.php.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I hadn't made a proper decision on these so just emptied them out. I think a formal deprecation makes sense.

* @return WP_Term|WP_Error|false Term object, if found. WP_Error if `$term_id` is shared between taxonomies and
* there's insufficient data to distinguish which term is intended.
* False for other failures.
* @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe clarify:

Suggested change
* @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`.
* @param string $taxonomy Optional. No longer used and silently deprecated.

Copy link
Member Author

@johnbillion johnbillion Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour of this parameter actually still applies, the existing test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() test covers it. It prevents a term in a different category being returned.

Comment on lines 69 to 99
include:
- os: 'ubuntu-24.04'
php: '7.2'
db-type: 'mysql'
db-version: '5.7'
wp: 4.2
multisite: false
- os: 'ubuntu-24.04'
php: '7.2'
db-type: 'mysql'
db-version: '5.7'
wp: 4.7
multisite: false
- os: 'ubuntu-24.04'
php: '7.2'
db-type: 'mysql'
db-version: '5.7'
wp: 5.2
multisite: false
- os: 'ubuntu-24.04'
php: '7.2'
db-type: 'mysql'
db-version: '5.7'
wp: 5.7
multisite: false
- os: 'ubuntu-24.04'
php: '7.2'
db-type: 'mysql'
db-version: '5.7'
wp: 6.2
multisite: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are all of these being removed as part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I should have made it clear that I'm still working on this PR and it's not quite ready for review yet (but thanks anyway!). I added these matrix entries to debug an issue I was seeing when experimenting with testing an upgrade from 4.2 right to 6.8. I'll remove or adjust these once I'm done.

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.

2 participants