PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / trunk
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / inc / functions / term-restrictions.php

term-restrictions.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More trunk, at inc/functions/term-restrictions.php

45 lines 936 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Restriction utility functions for post types.
4 *
5 * @package ContentControl
6 * @subpackage Functions
7 * @copyright (c) 2023 Code Atlantic LLC
8 */
9
10 namespace ContentControl;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Check if term has restrictions.
16 *
17 * @param int|null $term_id Term ID.
18 *
19 * @return bool
20 *
21 * @since 2.4.0
22 */
23 function term_has_restrictions( $term_id = null ) {
24 $overload_term = setup_term_globals( $term_id );
25
26 $has_restrictions = plugin( 'restrictions' )->has_applicable_restrictions( $term_id );
27
28 // Clear post if we overloaded it.
29 if ( $overload_term ) {
30 reset_term_globals();
31 }
32
33 /**
34 * Filter whether term has restrictions.
35 *
36 * @param bool $has_restrictions Whether post has restrictions.
37 * @param int|null $term_id Term ID.
38 *
39 * @return bool
40 *
41 * @since 2.0.0
42 */
43 return (bool) apply_filters( 'content_control/term_has_restrictions', $has_restrictions, $term_id );
44 }
45