{"id":19107761,"url":"https://github.com/alleyinteractive/internal-flags","last_synced_at":"2026-02-27T21:43:51.020Z","repository":{"id":38440403,"uuid":"251485472","full_name":"alleyinteractive/internal-flags","owner":"alleyinteractive","description":"Use a hidden taxonomy to improve expensive queries.","archived":false,"fork":false,"pushed_at":"2023-02-21T19:58:12.000Z","size":97,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":34,"default_branch":"develop","last_synced_at":"2024-10-13T21:54:18.570Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alleyinteractive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-31T02:57:09.000Z","updated_at":"2023-02-24T02:25:32.000Z","dependencies_parsed_at":"2023-02-01T01:30:52.547Z","dependency_job_id":null,"html_url":"https://github.com/alleyinteractive/internal-flags","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Finternal-flags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Finternal-flags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Finternal-flags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Finternal-flags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alleyinteractive","download_url":"https://codeload.github.com/alleyinteractive/internal-flags/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783042,"owners_count":17201915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-plugin"],"created_at":"2024-11-09T04:13:52.528Z","updated_at":"2026-02-27T21:43:45.969Z","avatar_url":"https://github.com/alleyinteractive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Internal Flags\n==============\n\n[![Testing Suite](https://github.com/alleyinteractive/internal-flags/actions/workflows/unit-test.yml/badge.svg)](https://github.com/alleyinteractive/internal-flags/actions/workflows/unit-test.yml)\n\nCreates a hidden taxonomy to improve expensive query performance by not relying on\nmeta queries. Allows for 'flags' to be set/unset on posts easily and entirely hidden\nfrom the end-user.\n\n## Instructions\n\nBy default, the internal taxonomy will be added to all registered post types.\n\n## Common Use Cases\n- Hiding from archives/searches\n- Posts by an author (where author is stored as a meta normally)\n- Showing/hiding sponsored posts\n\n## Usage\n\n### Setting a flag on a post\n```php\nuse Internal_Flags\\set_flag;\nset_flag( 'hide-from-archives', $post_id );\n```\n\n### Removing a flag on a post\n```php\nuse Internal_Flags\\remove_flag;\nremove_flag( 'hide-from-archives', $post_id );\n```\n\n### Checking if a flag is on a post\n```php\nuse Internal_Flags\\has_flag;\nhas_flag( 'hide-from-archives', $post_id ); // bool\n```\n\n### Searching for posts with a flag\n```php\nuse Internal_Flags\\get_flag_tax_query;\n$posts = new \\WP_Query(\n\t[\n\t\t// ...\n\t\t'tax_query' =\u003e [\n\t\t\tget_flag_tax_query( 'show-on-page' )\n\t\t],\n\t],\n);\n```\n\n### Searching for posts without a flag\n_Inverse of the above_\n```php\nuse Internal_Flags\\get_flag_tax_query;\n$posts = new \\WP_Query(\n\t[\n\t\t// ...\n\t\t'tax_query' =\u003e [\n\t\t\tget_flag_tax_query( 'hide-from-archives', false )\n\t\t],\n\t],\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Finternal-flags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falleyinteractive%2Finternal-flags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Finternal-flags/lists"}