Skip to main content

Questions tagged [metabox]

Refers to a box-like reusable user-interface component common in the WordPress backend.

Filter by
Sorted by
Tagged with
49 votes
2 answers
25k views

Create more Meta Boxes as needed

I'd like users to be able to create and remove additional meta box fields as needed. For example, say a music podcast with a variable amount of songs played per episode. The user should be able to ...
Picard102's user avatar
  • 933
51 votes
14 answers
81k views

meta_query with meta values as serialize arrays

I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in ...
tollmanz's user avatar
  • 5,560
27 votes
4 answers
37k views

How to set default screen options?

I'd love to be able to hide meta boxes using screen options, instead of removing them or restricting them to user roles, the goal is to just "uncheck" the meta box for the user. I see how this would ...
developdaly's user avatar
  • 1,797
21 votes
2 answers
63k views

Add "upload media" button in meta box field

I have a custom post which has a meta tag that needs to be using a file upload (for video files). I am wondering, what is the correct way of adding an "Upload" button that points to the WordPress ...
SpyrosP's user avatar
  • 515
23 votes
1 answer
43k views

Order by multiple meta key and meta value [closed]

How can I set multiple meta keys order by meta value, can any one give me some example?
Dhiraj Suthar's user avatar
12 votes
6 answers
10k views

Removing panels (meta boxes) in the Block Editor

When the Block Editor was added to WordPress, custom and core meta boxes became legacy, meaning, using the remove_meta_box() function won't work when removing meta boxes/panels displayed on the post ...
Christine Cooper's user avatar
  • 8,857
10 votes
1 answer
2k views

What is the index [0] for on post meta fields?

Trying to improve my PHP knowledge through test and try! I am confused on [0] arguments at following WordPress PHP code global $post; $custom = get_post_custom($post->ID); $price = $custom['price']...
Behseini's user avatar
  • 525
36 votes
5 answers
38k views

How can I put a custom meta box above the editor but below the title section on the edit post page?

I have a custom meta box for a custom post type that my client wants placed between the title/permalink section and the post editor in the admin panel. Is this possible and if so is there a hook/...
cstrouse's user avatar
  • 526
18 votes
5 answers
9k views

Can I add a Category Metabox to attachment?

I am using register_taxonomy_for_object_type() to add the Category taxonomy field to Media uploads (attachments). I'm using this code to do so: add_action('init', 'reg_tax'); function reg_tax() { ...
Rick Curran's user avatar
  • 1,076
4 votes
2 answers
2k views

How to add or remove metabox each page separately?

How to add a meta box for a particular page, say: for only About Us page. How shall i do? The current code adds the metaboxes for all pages: function myplugin_add_custom_box() { add_meta_box( ...
john cer's user avatar
23 votes
2 answers
18k views

How to show a custom meta box on the "Quick Edit" screen?

I've used add_meta_box() to add a custom meta box to the WordPress edit window on both pages and posts. How can I make this meta box also show on the "Quick Edit" screen? Ideally, I'd like it to ...
Scott B's user avatar
  • 5,696
22 votes
4 answers
14k views

Passing error/warning messages from a meta box to "admin_notices"

I have a simple meta box that updates the post custom fields (using update_post_meta()). How can I send a error or warning message to the next page after the user publishes/updates the post and doesn'...
onetrickpony's user avatar
  • 13.6k
9 votes
2 answers
9k views

Get List of Registered Meta Boxes and Removing Them

Is there a function for getting a list of registered Meta Boxes and removing them? I see there is a method for adding, and removing. http://codex.wordpress.org/Function_Reference/remove_meta_box ...
Michael Ecklund's user avatar
2 votes
2 answers
1k views

Modifying the main editor priority

I want the main WordPress post editor to appear below some of my meta boxes (generated by Advanced Custom Fields). I know there are the add_meta_box() and remove_meta_box() functions, however it'd be ...
Ben Everard's user avatar
  • 1,278
1 vote
1 answer
7k views

Custom meta box shown when template is chosen [duplicate]

Possible Duplicate: Toggle admin metabox based upon chosen page template Is this possible to change editor screen immediately after someone picks some template from the drop down? I need a ...
smogg's user avatar
  • 293
20 votes
8 answers
13k views

Disable dragging of meta boxes?

Anyone know how to disable this functionality so the meta boxes can't be repositioned?
fxfuture's user avatar
  • 1,337
16 votes
2 answers
5k views

Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?

I need to create a custom post meta box(es) for my custom post type "Slideshow" (this post type is already created). Each metabox will hold the content in each slide slide and save it to ...
matt's user avatar
  • 1,662
11 votes
2 answers
12k views

How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button

I have a custom post type (called contacts). Since this post type is not working like a post, I don't want to show SAVE DRAFT, PREVIEW, Status, Visibility or Publish Date. The only options I want to ...
katemerart's user avatar
9 votes
1 answer
6k views

How do I position meta_box on post edit screen after the title?

I am displaying a div in the Edit Post screen using add_meta_box(). This function provides very limited positioning options via "priority" and "context" params and these are not sufficient for my ...
AMcDermott's user avatar
7 votes
3 answers
2k views

How to Add Reminders/Notes to New Post Meta Boxes

I have a multi-author website and I use the WyPiekacz plugin to require that authors add 1-5 tags, select only a single category, and include a featured image (and require minimum dimensions for the ...
Travis Pflanz's user avatar
1 vote
1 answer
4k views

Dynamic page.php template for custom post types

I have a couple of custom post types registered. I would like to display all "posts" from each custom post type on its own page, and these pages must be visible in the nav menu. It would be great to ...
Pieter Goosen's user avatar
31 votes
3 answers
21k views

Set Default Admin Screen options & Metabox Order

I am desperately looking for some way (any way) to set default "screen options" and metabox order through the functions.php file. does anyone have any help they can provide here?
NetConstructor.com's user avatar
16 votes
6 answers
15k views

Trigger Javascript on Gutenberg (Block Editor) Save

So I have a metabox which I want to trigger some Javascript when a post is saved (to refresh the page in this use case.) In Classic Editor, this can be done via a simple redirect hooked to save_post ...
majick's user avatar
  • 5,131
11 votes
2 answers
11k views

Custom field/meta populated by dropdown of existing posts?

(My first WP question ever asked! Be gentle!) I'm building a site that is mostly pages (i.e., static), using WP as CMS. At the bottom of several of the pages, there will appear 1, 2, or 3 "promo ...
Nic Warmenhoven's user avatar
10 votes
5 answers
14k views

WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins

I have multi-author website and I am not very comfortable for allowing all members to enter SEO details in the posts they are publishing. I would like this would be visible only to Administrator of ...
Audrius's user avatar
  • 111
10 votes
6 answers
16k views

Change The Title Of a Meta Box

I'm trying to create a function that would allow me to change the title of an established meta box (i.e, change Meta Box title 'Authors' to 'Team', etc.) I didn't want to use JS or have to unset the ...
Syrehn's user avatar
  • 312
8 votes
2 answers
26k views

Post custom metabox textarea using wp_editor

I'm a novice and looking to add the wp_editor to a custom metabox textarea field. I've looked seemingly everywhere for an complete example for writing a metabox with a textarea that uses the wp_editor....
Travis Pflanz's user avatar
4 votes
1 answer
3k views

Metabox repeating fields - radio buttons not saving correctly

I have multiple radio buttons set up inside of a metabox in a custom post type. I have created the metabox like so: add_action('admin_init', 'add_meta_boxes', 1); function add_meta_boxes() { ...
EHerman's user avatar
  • 999
4 votes
1 answer
2k views

How do you remove a Category-style (hierarchical) taxonomy metabox?

I was wondering if someone can help me with this. I'm currently following Shibashake's tutorial about creating custom meta-boxes that include taxonomy selection here: http://shibashake.com/wordpress-...
Manny Fleurmond's user avatar
3 votes
1 answer
56k views

Add special meta box to custom post type

I have managed to add a meta box to my custom post type (see code below) Now I need to add another meta box. With this box I want to display / edit a value from another table called ...
cgscolonia's user avatar
3 votes
3 answers
7k views

Adding submit or update button to custom metabox?

I have alot of custom meta boxes, and the user has to scroll to the top everytime he wants to save the meta info. Is there a way to put submit buttons at every meta box that does that same as the ...
hamahama's user avatar
  • 213
2 votes
1 answer
4k views

How to sort CPT by custom meta value (date), and return posts month by month

For future reference: I am using the great Meta Box Plugin to help expedite meta box creation for my custom post types. My goal: To build a highly customizable events section closely resembling a ...
Mr.Brown's user avatar
  • 1,045
2 votes
2 answers
899 views

How to activate "Description" metabox for menu item programmatically?

I'm creating custom wordpress theme. How can I enable "Description" metabox for menu items (on nav-menu page) by default programmatically?
Stanislau Ladutska's user avatar
2 votes
3 answers
7k views

How to make a meta box field a requirement

I'm building a plugin that has a meta box. Some of the fields in the meta box are required. Is using jQuery the only method for achieving this? Can I require that a field is filled in using PHP?
user avatar
21 votes
3 answers
22k views

How to change default position of WP meta boxes?

Im wondering if there is a way to change the default position of Wordpresses meta boxes such as "featured image" for custom post types without having to drag them manually? Example:
Mr.Brown's user avatar
  • 1,045
18 votes
6 answers
24k views

Add a Meta Box for uploading a SECOND Featured Image?

I'd like to add a meta box to my posts and page editor that will allow me to upload an image and use it as sort of a SECOND featured image. The idea is that my client will be able to upload an image ...
jkupczak's user avatar
  • 1,056
15 votes
3 answers
35k views

Custom Taxonomy as checkbox or dropdown

I have registered a custom tax to my CPT. On the edit screen the tax meta box appears with an autocomplete field. Is it possible to display it as checkboxes or dropdown instead?
Julian F. Weinert's user avatar
8 votes
1 answer
5k views

Best practices for meta box placement?

I was wondering if there were any cut and dry rules to placing meta boxes? I have a meta box for a custom post type for a TV series that holds extra information for said series: when it began airing, ...
Manny Fleurmond's user avatar
8 votes
2 answers
13k views

Remove the Yoast SEO Post Metabox [closed]

Yoasts SEO plugin adds a metabox to the post edit screen. I'm trying to remove this for users who aren't editors or above. I've tried putting a remove_meta_box call in on admin_init, trying to remove ...
Tom J Nowell's user avatar
  • 60.6k
8 votes
3 answers
7k views

Make Custom Metaboxes Collapse by Default

I've created some custom metaboxes for my post write screen. Is there any way to make some of them display collapsed by default? Just in case I'm not using the correct terms or not being clear in ...
matt's user avatar
  • 1,662
8 votes
2 answers
4k views

Gutenberg add a custom metabox to default blocks

Is it possible to add custom meta boxes to the default blocks in Gutenberg? I would need to add a user-defined data-attribute to each block. This data-attribute then would be printed on the frontend ...
Bonttimo's user avatar
  • 193
7 votes
3 answers
8k views

Add metabox to document tab in gutenberg

How can I add custom metabox in document tab in gutenberg? There is documentation about adding plugin sidebar here, but I'm looking for adding custom metabox in existing document tab.
Ankit's user avatar
  • 344
5 votes
1 answer
11k views

WP_Query with checkbox meta_query

I have posted this on StackOverflow too, not sure if that's allowed - if not let me know and I'll remove one (I don't want to look like I'm spamming). Anyway.... I have a custom post type and have ...
Adam Moss's user avatar
  • 1,062
5 votes
3 answers
12k views

Custom Post Type - Taxonomy Dropdown Menu?

I have created a custom post type and added various meta boxes/fields to this custom post type. All is working excellent except for one element... Instead of utilizing the default interface for ...
NetConstructor.com's user avatar
5 votes
2 answers
4k views

Custom field metabox not showing in back-end

I recently updated my website after a while, and the custom fields meta box is not showing in the editor anymore. It isn't showing under "Screen Options" either. Any ideas why this could be, and how ...
Pim's user avatar
  • 1,152
4 votes
1 answer
6k views

How to add metabox for post of specific category

I want to add Metabox for the posts of category=18 and i am using the following code but unable to do so . So please help me out-> add_action('admin_init','my_meta_init'); function my_meta_init() { ...
terminator's user avatar
4 votes
3 answers
7k views

How to add meta box to backend menu page

I need to add a meta box to the backend menu page, in Appearance->Menus (/wp-admin/nav-menus.php), to list all the available post types, both the defaults & the custom ones. It will contain a ...
Giraldi's user avatar
  • 1,485
4 votes
2 answers
3k views

Using media-upload.php to upload mp3 via custom fields

I'm trying to use the Thickbox file upload dialogue with a custom field to allow the user to upload an mp3. What I want to do is to grab the URL of the uploaded mp3 and save it as postmeta (saving the ...
Richard Sweeney's user avatar
4 votes
5 answers
12k views

Remove custom meta boxes from custom post type

Is there a way to create a custom post type in WordPress that will only include the default meta boxes and not any other meta box that was added by other plugins? The idea is to use the custom post to ...
Bob Tolbert's user avatar
3 votes
2 answers
2k views

Remove tabs from media uploader for a CPT

I use the media uploader in a own meta-box for a custom post type called "premium". The Thickbox opens after a click of the button in the meta-box and files can be uploaded. Now I want to remove the ...
Guru 2.0's user avatar
  • 174

1
2 3 4 5