How to add custom meta box when you have a custom page template file

The front page configuration is a site option. You can know if the site is configured to display a page with get_option( ‘show_on_front’ ) and get the ID of the page with get_option( ‘page_on_front’ ). You could do something like this: add_action( ‘add_meta_boxes’, ‘cyb_add_metaboxes’, 10, 2 ); function cyb_add_metaboxes( $post_type, $post ) { if( $post->ID … Read more

Later blog post pages give 404 error

First, try rebuilding your permalinks. Go to Settings >> Permalinks and click Save, which will rebuild them. If that doesn’t work, go into your Settings >> Reading >> Blog pages show at most setting and try increasing or decreasing that and see how that changes things. Some themes have a setting that lets you adjust … Read more

Noindex subscriber author page

The function you want is get_userdata(). Since you need to do this outside the loop, the process is a little less straight-forward. The first thing you need to do is set up a variable called $curauth which is an object that you create by accessing the database by using the $_GET[] superglobal. $curauth = ( … Read more

Is it possible to restrict access to specific pages in the admin area based on the page slug?

So following from the comment discussion, a sufficient answer on another StackEx question goes like this: add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(’21’,’22’,’23’); } } The only part that’s terribly important to us is the array of post IDS. The problem is … Read more

How do I edit text displayed on my browser tab?

You can either use this code in your function.php remove_all_filters( ‘wp_title’ ); add_filter(‘wp_title’, ‘filter_pagetitle’, 99,1); function filter_pagetitle($title) { $title = get_bloginfo(‘name’); return $title; } Or install plugin like Yoast SEO. EDIT : Screenshot UPDATE : Change header.php in your theme folder if above solution doesn’t work for you. <title><?php get_bloginfo(‘name’); ?></title>

Huge number of 404 pages getting spawned

No, do not delete the pages. That will not solve your problem. What you need to do is fix your permalink settings. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. Chances are the 404 plugin is was the culprit here. You should flush your permalinks. Go … Read more