Okay so I'm trying to render a meta box.

This is what I have so far, trying to keep it as basic as possible:

add_action('load-post.php', 'ad_templates_callback' );
add_action('load-post-new.php', 'ad_templates_callback' );

function ad_templates_callback(){
    add_action('add_meta_boxes', 'ad_templates_add_meta_box');
    add_action('save_post', 'ad_templates_save_post');

function ad_templates_add_meta_box(){
    add_meta_box( 'ad_templates', 'Template Options', 'ad_templates_render', 'page', 'normal', 'default');

function ad_templates_render($object, $box){
    wp_nonce_field( basename(__FILE__), 'ad_templates_nonce' );
    global $post_id;
            balblabl test
function ad_templates_save_post(){

I have no idea why, but it doesn't show up on either the New Page or existing Page pages.

I've tried it with removing the 'load-post.php' hooks and I've tried it with using Posts instead of Pages.

I've copied this code from an earlier WP theme I've created (which successfully shows the boxes), with a slight edit to the theme slug. So somewhere, somehow I'm missing something.


Never mind I just went full potato and forgot to include the file into my functions.php

Is there any way to delete this question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.