Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6224333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:39:08+00:00 2026-05-24T08:39:08+00:00

i want to make this code for pages add_action( ‘add_meta_boxes’, ‘meta_box_video’ ); function meta_box_video()

  • 0

i want to make this code for pages

add_action( 'add_meta_boxes', 'meta_box_video' );
function meta_box_video()
{
    add_meta_box( 'video-meta-box-id', 'Video Embed', 'meta_box_callback', 'post', 'normal', 'high' );
}

function meta_box_callback( $post )
{
    $values = get_post_custom( $post->ID );
    $selected = isset( $values['meta_box_video_embed'] ) ? $values['meta_box_video_embed'][0] : '';

    wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
    ?>
    <p>
        <label for="meta_box_video_embed"><p>Video Embed</p></label>
        <textarea name="meta_box_video_embed" id="meta_box_video_embed" cols="62" rows="5" ><?php echo $selected; ?></textarea>
    </p>
    <p>Leave it Empty ( if you want to use an image thumbnail ) .</p>
    <?php   
}

add_action( 'save_post', 'meta_box_video_save' );
function meta_box_video_save( $post_id )
{
    // Bail if we're doing an auto save
    if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;

    // if our nonce isn't there, or we can't verify it, bail
    if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;

    // if our current user can't edit this post, bail
    if( !current_user_can( 'edit_post' ) ) return;

    // now we can actually save the data
    $allowed = array( 
        'a' => array( // on allow a tags
            'href' => array() // and those anchords can only have href attribute
        )
    );

    // Probably a good idea to make sure your data is set

    if( isset( $_POST['meta_box_video_embed'] ) )
        update_post_meta( $post_id, 'meta_box_video_embed', $_POST['meta_box_video_embed'] );

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:39:10+00:00Added an answer on May 24, 2026 at 8:39 am

    This:

    function meta_box_video()
    {
        add_meta_box( 'video-meta-box-id', 'Video Embed', 'meta_box_callback', 'post', 'normal', 'high' );
    }
    

    Should specify page not post.

    function meta_box_video()
    {                                      // --- Parameters: ---
        add_meta_box( 'video-meta-box-id', // ID attribute of metabox
                      'Video Embed',       // Title of metabox visible to user
                      'meta_box_callback', // Function that prints box in wp-admin
                      'page',              // Show box for posts, pages, custom, etc.
                      'normal',            // Where on the page to show the box
                      'high' );            // Priority of box in display order
    }
    

    Take a look at the Codex for add_meta_box(). The examples are very helpful. The portion you are interested in is under “Parameter”. The fourth parameter allows you to specify whether you want the metabox on pages, posts, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that I want to make point-free; (\k t -> chr
I want to make this specialized w/o changing main. Is it possible to specialize
I want to make this kind of query: create procedure something @name varchar(13) as
I don't want to make this into a which is better... MVC or WebForms
I have an element, like this: <div id=navleft> </div> I want to make this
I want to make something like this... :LoopBegin if ???? goto End some other
Let's make this very easy. What I want: @array = qw/one two one/; my
I want to make the line marked with // THIS LINE SHOULD BE PRINTING
I want to make a form like this, and i want to post the
I want to make a dropdown menu like delicious has at this http://delicious.com/search?context=all&p=sql&lc=1 page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.