Skip to content

Instantly share code, notes, and snippets.

@amirhmoradi
Created April 26, 2022 14:54
Show Gist options
  • Save amirhmoradi/2e44c2567936543f0f72e36e1485f338 to your computer and use it in GitHub Desktop.
Save amirhmoradi/2e44c2567936543f0f72e36e1485f338 to your computer and use it in GitHub Desktop.
/**
* This allows you to select custom pages types (in this example, post_type of 'legal') as your Wordpress's "Privacy Policy page"
* from Wordpress Admin > Settings > Privacy
**/
function amirhmoradi_add_legal_pages_to_get_pages($pages, $parsed_args)
{
$legal_pages = get_posts(array(
'post_type' => 'legal'
));
return array_merge($pages,$legal_pages);
}
add_filter('get_pages', 'amirhmoradi_add_legal_pages_to_get_pages', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment