HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/sg-cachepress/core/Supercacher/Supercacher_Terms.php
<?php
namespace SiteGround_Optimizer\Supercacher;

use SiteGround_Optimizer\Helper\Update_Queue_Trait;

/**
 * SG CachePress class that handle term actions and purge the cache.
 */
class Supercacher_Terms {
	use Update_Queue_Trait;
	/**
	 * Array of all taxonomies that should be ignored.
	 *
	 * @var array $ignored_taxonomies Array of all taxonomies that should be ignored.
	 */
	private $ignored_taxonomies = array(
		'product_type',
		'product_visibility',
	);

	/**
	 * Purge single term cache.
	 *
	 * @since  5.0.0
	 *
	 * @param  int $term_id The term id.
	 *
	 * @return bool         True on success, false on failure.
	 */
	public function get_term_url( $term_id ) {
		// Get the term.
		$term = \get_term( $term_id );

		// Bail if we should ignore the taxonomy.
		if ( 
			NULL === $term ||
			is_wp_error( $term ) ||
			in_array( $term->taxonomy, $this->ignored_taxonomies ) 
		) {
			return;
		}

		// Get term link.
		$term_url = \get_term_link( $term_id );

		if ( empty( $term_url ) ) {
			return;
		}

		return $term_url;
	}

	/**
	 * Purge the term and index.php cache.
	 *
	 * @since  5.0.0
	 *
	 * @param  int $term_id The term id.
	 */
	public function purge_term_and_index_cache( $term_id ) {
		$this->update_queue( array(
			get_rest_url(),
			get_home_url( null, '/' ),
			$this->get_term_url( $term_id ),
		) );
	}
}