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

  • Home
  • SEARCH
  • 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 6217933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:30:43+00:00 2026-05-24T07:30:43+00:00

Been trying to add custom post type which was successful the problem i am

  • 0

Been trying to add custom post type which was successful the problem i am having is with adding metabox and inputs for these post types here is the code i have:
functions.php
add_action(“admin_init”, “admin_init”);

    function admin_init(){
        add_meta_box("deal-meta", "Deal Options", "deal_options", "deal", "side", "low");
    }

    function deal_options(){
        global $post;
        $custom = get_post_custom($post->ID);
        $price = $custom["price"][0];
        $discount = $custom["discount"][0];
        $market_value = $custom["market_value"][0];
        $start_date = $custom["start_date"][0];
        $end_date = $custom["end_date"][0];
        $highlights = $custom["highlights"][0];
        $fine_print = $custom["fine_print"][0];
        $quick_description = $custom["quick_description"][0];
        ?>
        <label>Price:</label>
        <input name="price" value="<?php echo $price; ?>" />

        <label>Discount:</label>
        <input name="discount" value="<?php echo $discount; ?>" />

        <label>Market Value:</label>
        <input name="market_value" value="<?php echo $market_value; ?>" />

        <label>Start Date:</label>
        <input name="start_date" value="<?php echo $start_date; ?>" />

        <label>End Date:</label>
        <input name="end_date" value="<?php echo $end_date; ?>" />

        <label>Highlights:</label>
        <textarea cols="50" rows="5" name="highlights"><?php echo $highlights; ?></textarea>

        <label>Fine Print:</label>
        <textarea cols="50" rows="5" name="fine_print"><?php echo $fine_print; ?></textarea>

        <label>Quick Description:</label>
        <textarea cols="50" rows="5" name="quick_description"><?php echo $quick_description; ?></textarea>
        <?php
    }

    add_action('save_post', 'save_details');

    function save_details(){
        global $post;

        update_post_meta($post->ID, "price", $_POST["price"]);
        update_post_meta($post->ID, "discount", $_POST["discount"]);
        update_post_meta($post->ID, "market_value", $_POST["market_value"]);
        update_post_meta($post->ID, "start_date", $_POST["start_date"]);
        update_post_meta($post->ID, "end_date", $_POST["end_date"]);
        update_post_meta($post->ID, "highlights", $_POST["highlights"]);
        update_post_meta($post->ID, "fine_print", $_POST["fine_print"]);
        update_post_meta($post->ID, "quick_description", $_POST["quick_description"]);
    }

However when i go to the Add Deal it doesn’t show any of these, confused.

Any help will be appreciated

Thanks
Dave

Var dump :

array(2) {
  ["deal"]=>
  array(2) {
    ["side"]=>
    array(2) {
      ["core"]=>
      array(2) {
        ["submitdiv"]=>
        array(4) {
          ["id"]=>
          string(9) "submitdiv"
          ["title"]=>
          string(7) "Publish"
          ["callback"]=>
          string(20) "post_submit_meta_box"
          ["args"]=>
          NULL
        }
        ["Citiesdiv"]=>
        array(4) {
          ["id"]=>
          string(9) "Citiesdiv"
          ["title"]=>
          string(6) "Cities"
          ["callback"]=>
          string(24) "post_categories_meta_box"
          ["args"]=>
          array(1) {
            ["taxonomy"]=>
            string(6) "Cities"
          }
        }
      }
      ["low"]=>
      array(1) {
        ["postimagediv"]=>
        array(4) {
          ["id"]=>
          string(12) "postimagediv"
          ["title"]=>
          string(14) "Featured Image"
          ["callback"]=>
          string(23) "post_thumbnail_meta_box"
          ["args"]=>
          NULL
        }
      }
    }
    ["normal"]=>
    array(1) {
      ["core"]=>
      array(1) {
        ["slugdiv"]=>
        array(4) {
          ["id"]=>
          string(7) "slugdiv"
          ["title"]=>
          string(4) "Slug"
          ["callback"]=>
          string(18) "post_slug_meta_box"
          ["args"]=>
          NULL
        }
      }
    }
  }
  ["post"]=>
  array(1) {
    ["side"]=>
    array(1) {
      ["low"]=>
      array(1) {
        ["deal-meta"]=>
        array(4) {
          ["id"]=>
          string(9) "deal-meta"
          ["title"]=>
          string(12) "Deal Options"
          ["callback"]=>
          string(12) "deal_options"
          ["args"]=>
          NULL
        }
      }
    }
  }
}
  • 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-24T07:30:44+00:00Added an answer on May 24, 2026 at 7:30 am

    Try this…

    add_action("add_meta_boxes", "my_add_meta_boxes");
    function my_add_meta_boxes(){
        add_meta_box("deal-meta", "Deal Options", "deal_options", "deal", "side", "low");
    }
    

    Let me know if that works.

    —-EDIT—-

    Try adding the following as a plugin in your plugins directory. Disable your plugin, enable the test plugin, and add a post. The metabox should be at the bottom of the post edit screen.

    <?php
    /*
    Plugin Name: Metabox Test
    */
    
    add_action("plugins_loaded", "metaboxtest_action_plugins_loaded");
    
    function metaboxtest_action_plugins_loaded(){
        add_action("add_meta_boxes", "metaboxtest_action_add_meta_boxes");
    }
    
    function metaboxtest_action_add_meta_boxes(){
        add_meta_box("metabox-test", 
            "Testing", 
            "metaboxtest_metabox_output", 
            "post");
    }
    
    function metaboxtest_metabox_output(){
        echo "Hello World";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to add a custom fields into a custom content type, everything
I have been trying to build a custom uitableview swipe. I am successful in
I've been trying to add a swf over a swf on a html page,
I have been trying to learn how to add testing to existing code --
How add custom field dynamicly? I'm trying that, but the field won't insert into
I am trying to add an info button to my app to provide custom
I've been trying to create my own custom LiveValidation ( LiveValidation.com ) function that
I'm trying to get custom HttpHandler working in my sample web application. I've been
I'm experiencing a challenging problem, which has not been solvable - hopefully until now.
I'm trying to add a ticketing system to a custom back-end that powers the

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.