PHP code example of alleyinteractive / internal-flags

1. Go to this page and download the library: Download alleyinteractive/internal-flags library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alleyinteractive / internal-flags example snippets


use Internal_Flags\set_flag;
set_flag( 'hide-from-archives', $post_id );

use Internal_Flags\remove_flag;
remove_flag( 'hide-from-archives', $post_id );

use Internal_Flags\has_flag;
has_flag( 'hide-from-archives', $post_id ); // bool

use Internal_Flags\get_flag_tax_query;
$posts = new \WP_Query(
	[
		// ...
		'tax_query' => [
			get_flag_tax_query( 'show-on-page' )
		],
	],
);

use Internal_Flags\get_flag_tax_query;
$posts = new \WP_Query(
	[
		// ...
		'tax_query' => [
			get_flag_tax_query( 'hide-from-archives', false )
		],
	],
);