### Install WP Tag Order via Git Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Instructions for cloning the WP Tag Order plugin repository into the WordPress plugins directory using Git. ```bash cd /path-to-your/wp-content/plugins git clone git@github.com:sectsect/wp-tag-order.git ``` -------------------------------- ### Get Tag Order via REST API (cURL) Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Provides an example of how to retrieve the ordered tags for a specific post using the WP Tag Order REST API. The request is made using cURL and specifies the post ID. ```Bash curl --location 'https://your-wordpress-site.com/wp-json/wp-tag-order/v1/tags/order/123' ``` -------------------------------- ### Tag_Updater Class Usage (PHP) Source: https://github.com/sectsect/wp-tag-order/blob/master/CLAUDE.md Example of how to use the Tag_Updater class to programmatically update tag order for a post. ```PHP $updater = new \WP_Tag_Order\Tag_Updater(); $result = $updater->update_tag_order($post_id, $taxonomy, $tag_ids); ``` -------------------------------- ### Get Tag List Ordered - PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Outputs a formatted list of ordered tags for the current post using the `get_the_tag_list_ordered()` function. ```php ``` -------------------------------- ### Get Term List Ordered - PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Outputs a formatted list of ordered terms for a specific taxonomy and post ID using the `get_the_term_list_ordered()` function. ```php ID, 'post_tag' ); ?> ``` -------------------------------- ### Update Tag Order via REST API (cURL) Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Demonstrates how to update the tag order for a post using the WP Tag Order REST API with a PUT request. This example uses cURL and includes authentication headers and a JSON payload specifying the taxonomy and desired tag order. ```Bash curl --location --request PUT 'https://your-wordpress-site.com/wp-json/wp-tag-order/v1/tags/order/123' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_JWT_TOKEN' \ --data '{ "taxonomy": "post_tag", "tags": "5,3,1,4,2" }' ``` -------------------------------- ### Get Ordered Tags - PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Retrieves and displays an ordered list of tags for the current post using the `get_the_tags_ordered()` function. It handles cases where tags might not be available or an error occurs. ```php
``` -------------------------------- ### Get Ordered Terms - PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Retrieves and displays an ordered list of terms for a specific taxonomy (e.g., 'post_tag') for a given post ID using `get_the_terms_ordered()`. It includes error checking. ```php ID, 'post_tag' ); if ( $terms && ! is_wp_error( $terms ) ) : ?> ``` -------------------------------- ### PHP Development Commands (composer) Source: https://github.com/sectsect/wp-tag-order/blob/master/CLAUDE.md Commands for PHP development, specifically running static analysis with PHPStan. ```Shell composer run phpstan ``` -------------------------------- ### Frontend Development Commands (pnpm) Source: https://github.com/sectsect/wp-tag-order/blob/master/CLAUDE.md Commands for managing frontend development tasks using pnpm, including building, linting, and type checking. ```Shell pnpm run dev pnpm run build pnpm run lint pnpm run lint:fix pnpm run lint:css pnpm run type-check ``` -------------------------------- ### REST API Endpoints (WP Tag Order) Source: https://github.com/sectsect/wp-tag-order/blob/master/CLAUDE.md Details of the REST API endpoints provided by the WP Tag Order plugin for managing tag order. ```HTTP GET /wp-json/wp-tag-order/v1/tags/order/{post_id} PUT /wp-json/wp-tag-order/v1/tags/order/{post_id} ``` -------------------------------- ### The Tags Ordered - PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Directly outputs the ordered tags for the current post using the `the_tags_ordered()` function. ```php ``` -------------------------------- ### REST API Response for Tag Order Update Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Illustrates a successful response from the WP Tag Order REST API after updating the tag order. The JSON response includes a success status, code, message, and the updated tag data. ```JSON { "success": true, "code": "tags_order_updated", "message": "Tag order updated successfully.", "data": { "status": 200, "post_id": 123, "taxonomy": "post_tag", "tags": [ 5, 3, 1, 4, 2 ] } } ``` -------------------------------- ### Display Ordered Tags in PHP Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Demonstrates how to display the ordered tags for a post using the `the_terms_ordered()` function in PHP. This function is part of the WP Tag Order plugin. ```PHP ID, 'post_tag' ); ?> ``` -------------------------------- ### Programmatically Update Tag Order with Tag_Updater Class Source: https://github.com/sectsect/wp-tag-order/blob/master/README.md Shows how to use the `Tag_Updater` class to programmatically manage tag order for a post. It supports updating tags using an array of IDs and includes error handling for invalid arguments. The function returns a meta ID, true on success, or false on failure. ```PHP $tag_updater = new \WP_Tag_Order\Tag_Updater(); try { // Update tag order using an array or comma-separated string $result = $tag_updater->update_tag_order( get_the_ID(), // Post ID 'post_tag', // Taxonomy that enabled in plugin settings [1, 2, 3] // Tag IDs in desired order ); } catch ( \InvalidArgumentException $e ) { // Error handling error_log( $e->getMessage() ); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.