sectsect/wp-tag-order

Sort the tags manually in individual posts on wordpress.

Installs: 326

Dependents: 0

Suggesters: 0

Security: 0

Stars: 20

Watchers: 3

Forks: 3

Open Issues: 4

Type:wordpress-plugin


README

PHP Unit Tests PHPStan PHP Coding Standards Latest Stable Version

Order tags independently in each posts (not site-globally) on WordPress with simple Drag-and-Drop ↕︎ sortable feature.

Important

This plugin is NOT compatible with Gutenberg on WordPress 5.x. Consider using Classic Editor Plugin.

Important

Mutation events will no longer be supported in Google Chrome and Edge in July 2024 (Google Chrome on July 23, 2024, and Microsoft Edge the week of July 25, 2024). As a result, WP Tag Order versions 3.6.0 or less will not work with Chrome v127 and later, which will be released on July 23, 2024.
You have to update to v3.7.0 or later.
If you still need PHP7 support, see Troubleshooting below.
See Chrome for Developers Blog for more details.

Get Started

  1. Clone this Repo into your wp-content/plugins directory.
$ cd /path-to-your/wp-content/plugins/
$ git clone git@github.com:sectsect/wp-tag-order.git
  1. Activate the plugin through the Plugins menu in WordPress.
  2. Go to Settings -> WP Tag Order page to select which taxonomies to enable ordering for.

Features

  • Support post_tag and non-hierarchical taxonomy.
  • Support multiple non-hierarchical taxonomies in a post-type.
  • Support Multisite.

Notes

  • When creating a new post, you need to save it once to enable tag ordering.
  • To apply ordering to existing posts, "Add and Remove" any tag once.
  • To bulk-update multiple posts at once, go to Settings -> WP Tag Order page and click 'Apply' under the Advanced Settings.
  • Tested on WordPress v6.3.1.

Requirements

  • WordPress 5.6+
  • PHP 8.0+

APIs

Usage Example

get_the_tags_ordered()

<?php
$terms = get_the_tags_ordered();
if ( $terms && ! is_wp_error( $terms ) ) :
?>
<ul>
    <?php foreach ( $terms as $term ) : ?>
        <li>
            <a href="<?php echo get_term_link( $term->slug, 'post_tag' ); ?>">
                <?php echo $term->name; ?>
            </a>
        </li>
    <?php endforeach; ?>
</ul>
<?php endif; ?>

get_the_terms_ordered()

<?php
$terms = get_the_terms_ordered( $post->ID, 'post_tag' );
if ( $terms && ! is_wp_error( $terms ) ) :
?>
<ul>
    <?php foreach ( $terms as $term ) : ?>
        <li>
            <a href="<?php echo get_term_link( $term->slug, 'post_tag' ); ?>">
                <?php echo $term->name; ?>
            </a>
        </li>
    <?php endforeach; ?>
</ul>
<?php endif; ?>

get_the_tag_list_ordered()

<?php echo get_the_tag_list_ordered(); ?>

get_the_term_list_ordered()

<?php echo get_the_term_list_ordered( $post->ID, 'post_tag' ); ?>

the_tags_ordered()

<?php the_tags_ordered(); ?>

the_terms_ordered()

<?php the_terms_ordered( $post->ID, 'post_tag' ); ?>

For Developers

  • The ordered tag data is serialized and stored in the wp_postmeta table under keys like wp-tag-order-{taxonomy}.

  • This Plugin does not hosting on the wordpress.org repo in order to prevent a flood of support requests from wide audience. Your feedback is welcome.

Troubleshooting

Still need support for PHP 7.

I have a branch php7 to support PHP 7 and End-of-Life for JaveScript Mutation events.
The branch will not be maintained anymore, so I recommend you migrate to PHP 8.

Change log

See CHANGELOG file.

License

See LICENSE file.

✌️

A little project by @sectsect