Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
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
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
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
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
29 votes
3 answers
35k views

Only one category per post

How to make each post/page have one and only one category. Categories could have radio box instead of checkbox next to each.
Adam's user avatar
  • 361
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
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
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
5 answers
30k views

Remove Custom Taxonomy Metabox from Custom Post Type Screen

I have two hierarchical custom taxonomies, each on a corresponding custom post type. I would like to remove the metabox for each on the post type's edit screen. I have read remove custom taxonomy ...
mrwweb's user avatar
  • 10.3k
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
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
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
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
18 votes
4 answers
9k views

Do I need a nonce field for every meta box I add to my custom post type admin?

I'm currently working on the admin page of my custom post type, and I got stuck on deciding whether to add a nonce field again for the second metabox or not. I'm very new to custom post types, and ...
Ana Ban's user avatar
  • 797
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
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
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
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
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
13 votes
1 answer
7k views

What is the "Advanced" $context in add_meta_box?

In the codex it lists the parameter $context for the add_meta_box as having the following options: normal advanced side What does "advanced" do? I don't see any difference between it and "...
matt's user avatar
  • 1,662
13 votes
1 answer
6k views

Is there an easy way to make a meta box have the tabs like the Categories meta box has?

My question is pretty much summed up in the title. I'm dropping a meta box in the New Post / Edit Post admin page, and I want to be able to set it up with tabs like the Categories meta box has. I ...
Jason Rhodes'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
12 votes
6 answers
8k views

Does Wordpress have a "Form API"?

I do most of my development in Drupal. However I'm working on a Wordpress site and I need to make a form. Which got me thinking: Is there something like a Form API for WordPress like there is in ...
Kelly Hays's user avatar
12 votes
2 answers
8k views

Setting admin edit panels & metaboxes positions and visibility for ALL users and admins

My WP 3.3 setup involves several post types and customized edit panels with Advanced Custom Fields plugin (which creates many metaboxes) and other plugins such as SEO metabox panel, Scribu's ...
unfulvio's user avatar
  • 1,824
11 votes
2 answers
19k views

Metabox with checkbox is not updating

I trying to set a meta_box with a single checkbox, everything goes fine, however if I uncheck it and save the post, it marks again as checked, I've been taking a look but I cannot find my mistake. ...
andresmijares's user avatar
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
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
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
2 answers
9k views

Reset positions of metaboxes in admin

I am writing a theme and in it I have a function which creates two metaboxes. The forth parameter of the "add_meta_box()" function I used can be set to ( high, core, default or low). I want the boxes ...
byronyasgur's user avatar
  • 3,032
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
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
9 votes
4 answers
13k views

Remove the Featured Image Meta Box

How can I remove the Featured Image meta box? I've tried using the remove_meta_box function and specifying the boxes ID but it doesn't seem to work like it does for the other native meta boxes. ...
matt's user avatar
  • 1,662
9 votes
6 answers
39k views

How do I get attachment_id?

This is trivial, but I can't really find an answer, I've seen some hints like search in database etc., but this is madness. Basically, I have a metabox with upload button that allows you to upload or ...
Wordpressor's user avatar
  • 5,051
9 votes
2 answers
3k views

How to make open/closed and hidden/shown metaboxes status saved on a per-post basis?

My real problem is a bit complex, so I'll try here to abstract it and keep it simple. I'm working on a custom app based on WordPress. I registered a custom post type, let's call it "people" where I ...
gmazzap's user avatar
  • 46.3k
9 votes
1 answer
6k views

How To Remove The "+ Add New Category" Link From A Category Metabox

Inside of a Wordpress category metabox or any custom taxonomy box for that matter there is a link with the text "+ Add New Category" is there a way this link can be removed preferably without ...
Dwayne Charrington's user avatar
9 votes
1 answer
14k views

How to add tab which is visible only in admin side of product in woocommerce? [closed]

I am new in wordpress development. I want to do add settings in a product page in a new tab. How to I add settings code That I tried to add Tab //add product tab link in admin add_action(...
Dipika's user avatar
  • 105
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
9 votes
1 answer
2k views

How Does Wordpress Remember Metabox Positions?

I was wondering how Wordpress remembers the position of metaboxes: session basis, user basis, computer basis? Does it set a cookie? Is it saved in the database?
Howdy_McGee's user avatar
  • 20.8k
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
9 votes
1 answer
4k views

Taxonomy dropdown metabox in the back-end

I've created custom taxonomy called Brands and made it hierarchical so I can add Car brands and models there and keep their relations, like this: Ford Mustang Mondeo Focus Problem is, this list ...
Kovas's user avatar
  • 433
9 votes
2 answers
8k views

Meta Boxes: 'admin_init' or 'add_meta_boxes' hook?

When setting up meta boxes in a custom post type I've been do so using the add_meta_boxes hook, e.g. add_action('add_meta_boxes', 'meta_box_setup'); function meta_box_setup() { add_meta_box( ...
sleeper's user avatar
  • 623
9 votes
3 answers
4k views

Add default WordPress tag meta box to User Profile

I've set up my user profiles to allow custom taxonomies following this tutorial. Ideally, I'd like to use the default Tag meta box from the Post screen, so users can easily add new terms and find ...
epschmidt's user avatar
9 votes
2 answers
4k views

How can I create a taxonomy meta-box with search suggestions but no new terms input?

I was wondering how I could setup a taxonomy metabox on a post edit page that would be similar to the "tags" kind (with search field and automatic suggestions), but without the right to add a new term....
mike23's user avatar
  • 6,029
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
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
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
7 answers
13k views

How to display non-hierarchical taxonomy as terms with checkboxes?

I'd like to have a non-hierarchical custom taxonomy displayed in the add/edit posts admin screen for a custom post type. Obviously, when the custom taxonomy is non-hierarchical, the meta box that's ...
Philip Downer's user avatar
8 votes
4 answers
18k views

Creating a metabox to upload multiple images

Is it possible to make a meta box that attaches multiple images to a post?
agileapricot's user avatar
  • 1,519
8 votes
7 answers
7k views

Individual Widgets per Page

In my (page-only, no posts) Wordpress site I have a number of static blobs in need to put in a sidebar. We could call/tream thoses 'blobs' as widgets. At least they'll have a fixed html content, like '...
Frank N's user avatar
  • 465

1
2 3 4 5
33