The admin bar is initialized on template_redirect
. You must be short-circuiting that.
The quick and dirty method would be to run _wp_admin_bar_init();
near the top of your page.
add_filter('wp_title', function($title, $sep, $seplocation) { return 'Register'; }, 10, 2);
_wp_admin_bar_init(); // <- this <-
get_header();
get_template_part('includes/breadcrumbs');
get_template_part('includes/top_info');
It would be somewhat neater to simply hook your function to template_redirect
instead, though, and unless you have compelling reasons to be using the somewhat odd hook choice of parse_query
, that is what I’d recommend.
add_action( 'template_redirect', function()
{
global $wp_query;
if (array_key_exists('virtualpage', $wp_query->query_vars))
{
switch ($wp_query->query_vars['virtualpage'])
{
case '1' :
include 'page-register.php';
break;
}
exit();
}
return;
});