I am trying to do something with Wordpress. I want to use it pageas a wrapper for custom content, so I set up an action that adds a specific one meta_keyfor each regular page so that I can select regular pages from my "special pages".
function addMetaToPage($post_id) {
if ( wp_is_post_revision( $post_id ) )
return;
if(get_post_type($post_id) == 'page') {
add_post_meta($post_id, '_regular_page', 1, true);
}
}
if(is_admin()) {
add_action('save_post', 'addMetaToPage');
}
Then, in the admin backend, where the pages are listed, I launch this hook so that all my "special pages" are not displayed.
if(is_admin()) {
add_action('pre_get_posts', function($query) {
$query->set('meta_key', '_regular_page');
$query->set('meta_value', 1);
});
}
. meta _regular_page === 1. , , , All (15), , . . 4 6 , - _regular_page.
? , WP_Query, , -, .