Skip to content

Conversation

@sectsect
Copy link
Owner

@sectsect sectsect commented Nov 16, 2025

Summary

Resolve WordPress Plugin Check naming convention violations by unifying all function and constant prefixes to the WordPress-compliant format.

Changes

  • 38 functions renamed from mixed prefixes to wp_tag_order_*
  • wptagorder_*wp_tag_order_* (5 functions)
  • wpto_*wp_tag_order_* (18 functions)
  • wto_*wp_tag_order_* (15 functions)
  • 8 constants renamed to WP_TAG_ORDER_*
  • All test files updated to reflect new naming
  • All call sites updated across the codebase

Breaking Changes

None - all changes are internal implementation only. Public APIs remain unchanged:

  • Template functions (no prefix): get_the_tags_ordered(), etc.
  • REST endpoints: /wp-json/wp-tag-order/v1/...
  • Namespace: WP_Tag_Order\

Verification

  • ✅ PHPStan: No errors
  • ✅ TypeScript type-check: Pass
  • ✅ Production build: Success
  • ✅ All tests updated

Related

Fixes WordPress Plugin Check violations from Actions runs:


Note

Renames internal functions, constants, filters, and callbacks to the WP-compliant wp_tag_order_*/WP_TAG_ORDER_* prefixes and updates all call sites and tests.

  • Core prefix unification:
    • Rename all functions to wp_tag_order_* (e.g., meta key helpers, casting utilities, validators, AJAX helpers, script tag filter, metabox handlers, REST handlers, permission checks).
    • Rename constants to WP_TAG_ORDER_* (meta key prefix, REST namespace, options/actions, PHP version minimum, settings args).
    • Update filter/action names to wp_tag_order_* (e.g., wp_tag_order_enabled_taxonomies, wp_tag_order_non_hierarchical_taxonomies, plugin_row_meta callback).
  • Includes updates:
    • includes/functions.php, index.php, category-template.php, rest-api.php, class-tag-updater.php updated to new names and meta key builder wp_tag_order_meta_key().
    • Adjust add_action/add_filter registrations and option keys where referenced.
  • REST API:
    • Route callbacks switched to new names; validation and permission functions renamed; behavior and routes unchanged.
  • Admin/UI:
    • Metabox render/save and admin enqueue/options page handlers renamed; settings registration uses WP_TAG_ORDER_* constants.
  • Tests:
    • All test files updated to call new function/constant names and filters.

Written by Cursor Bugbot for commit 6179d70. This will update automatically on new commits. Configure here.

Rename 8 constants to comply with WordPress naming conventions:
- WPTAGORDER_* → WP_TAG_ORDER_* (7 constants)
- WTO_SETTING_ARGS → WP_TAG_ORDER_SETTING_ARGS (1 constant)

Updated all references in 6 files:
- wp-tag-order.php
- includes/functions.php
- includes/index.php
- includes/rest-api.php
- options/index.php

Also added prefix unification documentation.

Part of prefix unification to resolve Plugin Check violations.
PHPStan: ✓ No errors, Syntax check: ✓ Pass
Rename 15 utility functions to comply with WordPress naming:
- wto_meta_key → wp_tag_order_meta_key
- wto_form_field_name → wp_tag_order_form_field_name
- wto_is_array_empty → wp_tag_order_is_array_empty
- wto_array_diff_interactive → wp_tag_order_array_diff_interactive
- wto_get_non_hierarchical_taxonomies → wp_tag_order_get_non_hierarchical_taxonomies
- wto_get_enabled_taxonomies → wp_tag_order_get_enabled_taxonomies
- wto_is_enabled_taxonomy → wp_tag_order_is_enabled_taxonomy
- wto_has_enabled_taxonomy → wp_tag_order_has_enabled_taxonomy
- wto_get_post_types_by_taxonomy → wp_tag_order_get_post_types_by_taxonomy
- wto_has_tag_posttype → wp_tag_order_has_tag_posttype
- wto_strposa → wp_tag_order_strposa
- wto_replace_script_tag → wp_tag_order_replace_script_tag
- wto_has_reorder_controller_in_metaboxes → wp_tag_order_has_reorder_controller_in_metaboxes

Updated all call sites in 6 files.

Part of prefix unification to resolve Plugin Check violations.
PHPStan: ✓ No errors, Syntax check: ✓ Pass
- Rename 18 functions from wpto_* to wp_tag_order_*
- includes/rest-api.php (8 REST API functions)
- includes/index.php (7 admin functions)
- includes/functions.php (5 utility functions)
- Update all callback strings in register_rest_route
- Update all add_action hooks
- Update all function call sites

Part of prefix unification to comply with WordPress naming
conventions and resolve Plugin Check violations.
- Rename 5 functions from wptagorder_* to wp_tag_order_*
- wp_tag_order_notice_php_version_wrong
- wp_tag_order_check_php_version
- wp_tag_order_handle_php_version_error
- wp_tag_order_php_version_check
- wp_tag_order_add_github_link
- Update add_action and add_filter hooks
- Update all internal function calls

Part of prefix unification to comply with WordPress naming
conventions and resolve Plugin Check violations.
Update all test files to reference the new unified function names
after prefix unification from wpto_*/wto_* to wp_tag_order_*.

Changes:
- tests/FunctionTests.php: Update @Covers annotations and function calls
- tests/RestApiTests.php: Update @Covers, function calls, and filter names
- tests/IndexTests.php: Update @Covers and function calls
- tests/class-test-tag-updater.php: Update filter names and function calls

Part of prefix unification to comply with WordPress naming conventions.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.


// Get all non-hierarchical taxonomies for reference.
$available_taxonomies = apply_filters( 'wpto_non_hierarchical_taxonomies', wto_get_non_hierarchical_taxonomies() );
$available_taxonomies = apply_filters( 'wpto_non_hierarchical_taxonomies', wp_tag_order_get_non_hierarchical_taxonomies() );
Copy link

Choose a reason for hiding this comment

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

Bug: Filter Naming Mismatch Breaks Functionality

Filter names wpto_enabled_taxonomies and wpto_non_hierarchical_taxonomies were not updated to match the new naming convention (wp_tag_order_enabled_taxonomies and wp_tag_order_non_hierarchical_taxonomies), while the test files were updated to use the new names. This creates a mismatch where tests hook into non-existent filters, causing test failures and breaking any external code that might filter these values.

Fix in Cursor Fix in Web

- Update wto_meta_key() to wp_tag_order_meta_key() in CategoryTemplateTests.php
- Update filter names in rest-api.php:
  - wpto_allowed_post_types → wp_tag_order_allowed_post_types
  - wpto_enabled_taxonomies → wp_tag_order_enabled_taxonomies
  - wpto_non_hierarchical_taxonomies → wp_tag_order_non_hierarchical_taxonomies

Fixes PHPUnit errors caused by undefined function and filter name mismatches.
@sectsect sectsect merged commit 9989c88 into master Nov 17, 2025
10 checks passed
@sectsect sectsect deleted the bugfix/plugin-check branch November 17, 2025 02:18
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