Plugin Directory

Changeset 3458362


Ignore:
Timestamp:
02/10/2026 07:49:25 PM (6 weeks ago)
Author:
happyprime
Message:

Update to version 1.2.3 from GitHub

Location:
shadow-terms
Files:
2 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shadow-terms/tags/1.2.3/LICENSE

    r3311131 r3458362  
    11Shadow Terms plugin for WordPress
    22
    3 Copyright 2022-2025 by Happy Prime and contributors
     3Copyright 2022-2026 by Happy Prime and contributors
    44
    55This program is free software; you can redistribute it and/or modify
  • shadow-terms/tags/1.2.3/includes/api.php

    r3311131 r3458362  
    77
    88namespace ShadowTerms\API;
     9
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
    913
    1014/**
  • shadow-terms/tags/1.2.3/includes/sync.php

    r3311131 r3458362  
    77
    88namespace ShadowTerms\Sync;
     9
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
    913
    1014add_action( 'wp_after_insert_post', __NAMESPACE__ . '\sync_shadow_taxonomies', 10, 4 );
     
    8892    }
    8993
     94    // If a post is already published and not undergoing a status change, but does not
     95    // have an associated term, create one.
     96    if ( 'publish' === $status_before && 'publish' === $status_after && false === $term_after ) {
     97        // In the very unlikely condition that a term _was_ associated, but now is
     98        // lost to the ether, attempt to restore previous post associations.
     99        $existing_associations = (array) get_post_meta( $post_id, "{$taxonomy}_associated_posts", true );
     100        $existing_associations = array_filter( $existing_associations );
     101
     102        $new_term = wp_insert_term( $title_after, $taxonomy );
     103
     104        if ( is_wp_error( $new_term ) ) {
     105            return;
     106        }
     107
     108        foreach ( $existing_associations as $association ) {
     109            wp_set_object_terms( $association, $new_term['term_id'], $taxonomy );
     110        }
     111
     112        return;
     113    }
     114
    90115    // If the post transitioned from published to not published, remove the associated term.
    91116    if ( 'publish' !== $status_after && $term_before ) {
  • shadow-terms/tags/1.2.3/includes/taxonomy.php

    r3311131 r3458362  
    99
    1010use ShadowTerms\API;
     11
     12if ( ! defined( 'ABSPATH' ) ) {
     13    exit;
     14}
    1115
    1216add_action( 'init', __NAMESPACE__ . '\register', 9999 );
  • shadow-terms/tags/1.2.3/plugin.php

    r3311131 r3458362  
    33 * Plugin Name:  Shadow Terms
    44 * Description:  Use terms from generated taxonomies to associate related content.
    5  * Version:      1.2.2
     5 * Version:      1.2.3
    66 * Plugin URI:   https://github.com/happyprime/shadow-terms/
    77 * Author:       Happy Prime
     
    2727namespace ShadowTerms;
    2828
    29 // If this file is called directly, abort.
    30 if ( ! defined( 'WPINC' ) ) {
    31     die;
     29if ( ! defined( 'ABSPATH' ) ) {
     30    exit;
    3231}
    3332
  • shadow-terms/tags/1.2.3/readme.txt

    r3311131 r3458362  
    33Tags: terms, related, content
    44Requires at least: 5.9
    5 Tested up to: 6.8
    6 Stable tag: 1.2.2
     5Tested up to: 6.9
     6Stable tag: 1.2.3
    77License: GPLv2 or later
    88Requires PHP: 7.4
     
    4141## Changelog
    4242
     43### 1.2.3
     44
     45* In a case where a published post is missing its associated shadow term, create one on post update.
     46* Bail early on direct access to plugin files.
     47* Confirm WordPress 6.9 support.
     48* Update development dependencies.
     49
    4350### 1.2.2
    4451
  • shadow-terms/trunk/LICENSE

    r3311131 r3458362  
    11Shadow Terms plugin for WordPress
    22
    3 Copyright 2022-2025 by Happy Prime and contributors
     3Copyright 2022-2026 by Happy Prime and contributors
    44
    55This program is free software; you can redistribute it and/or modify
  • shadow-terms/trunk/includes/api.php

    r3311131 r3458362  
    77
    88namespace ShadowTerms\API;
     9
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
    913
    1014/**
  • shadow-terms/trunk/includes/sync.php

    r3311131 r3458362  
    77
    88namespace ShadowTerms\Sync;
     9
     10if ( ! defined( 'ABSPATH' ) ) {
     11    exit;
     12}
    913
    1014add_action( 'wp_after_insert_post', __NAMESPACE__ . '\sync_shadow_taxonomies', 10, 4 );
     
    8892    }
    8993
     94    // If a post is already published and not undergoing a status change, but does not
     95    // have an associated term, create one.
     96    if ( 'publish' === $status_before && 'publish' === $status_after && false === $term_after ) {
     97        // In the very unlikely condition that a term _was_ associated, but now is
     98        // lost to the ether, attempt to restore previous post associations.
     99        $existing_associations = (array) get_post_meta( $post_id, "{$taxonomy}_associated_posts", true );
     100        $existing_associations = array_filter( $existing_associations );
     101
     102        $new_term = wp_insert_term( $title_after, $taxonomy );
     103
     104        if ( is_wp_error( $new_term ) ) {
     105            return;
     106        }
     107
     108        foreach ( $existing_associations as $association ) {
     109            wp_set_object_terms( $association, $new_term['term_id'], $taxonomy );
     110        }
     111
     112        return;
     113    }
     114
    90115    // If the post transitioned from published to not published, remove the associated term.
    91116    if ( 'publish' !== $status_after && $term_before ) {
  • shadow-terms/trunk/includes/taxonomy.php

    r3311131 r3458362  
    99
    1010use ShadowTerms\API;
     11
     12if ( ! defined( 'ABSPATH' ) ) {
     13    exit;
     14}
    1115
    1216add_action( 'init', __NAMESPACE__ . '\register', 9999 );
  • shadow-terms/trunk/plugin.php

    r3311131 r3458362  
    33 * Plugin Name:  Shadow Terms
    44 * Description:  Use terms from generated taxonomies to associate related content.
    5  * Version:      1.2.2
     5 * Version:      1.2.3
    66 * Plugin URI:   https://github.com/happyprime/shadow-terms/
    77 * Author:       Happy Prime
     
    2727namespace ShadowTerms;
    2828
    29 // If this file is called directly, abort.
    30 if ( ! defined( 'WPINC' ) ) {
    31     die;
     29if ( ! defined( 'ABSPATH' ) ) {
     30    exit;
    3231}
    3332
  • shadow-terms/trunk/readme.txt

    r3311131 r3458362  
    33Tags: terms, related, content
    44Requires at least: 5.9
    5 Tested up to: 6.8
    6 Stable tag: 1.2.2
     5Tested up to: 6.9
     6Stable tag: 1.2.3
    77License: GPLv2 or later
    88Requires PHP: 7.4
     
    4141## Changelog
    4242
     43### 1.2.3
     44
     45* In a case where a published post is missing its associated shadow term, create one on post update.
     46* Bail early on direct access to plugin files.
     47* Confirm WordPress 6.9 support.
     48* Update development dependencies.
     49
    4350### 1.2.2
    4451
Note: See TracChangeset for help on using the changeset viewer.