All Questions
Tagged with add-meta-box or metabox
1,647 questions
4
votes
3
answers
4k
views
Auto close (hide) custom metabox / set default state
I am using the WordPress function add_meta_box() to add my own custom metabox.
So how can I auto close/hide on page open ?
Currently, I just add a CSS class closed to metabox's <div> element ...
3
votes
2
answers
3k
views
Add description to custom taxonomy admin metabox
I've created a custom taxonomy:
add_action( 'init', 'create_collection_taxonomies', 0 );
function create_collection_taxonomies() {
$labels = array(
'name' => _x( '...
0
votes
1
answer
51
views
Custom Post Meta from custom metaboxes is randomly being deleted
For a while now I've been applying and updating some custom metaboxes that my company re-uses on different sites. (Not the same metaboxes, but the same methodology.)
Essentially it allows for the '...
0
votes
1
answer
26
views
How to insert data into meta box from another plugin?
I have two different plugins. My custom-post-type is on the first plugin and it has some meta boxes. Now in the second plugin, I extracted the email using IMAP and stored it in the post type of the ...
0
votes
2
answers
1k
views
Post edit screen: How to check if meta_box is registered?
I got some custom post types where i deregistered the "title" meta box. Now i always get "Auto Draft" as title. To avoid this i'd like to add the name of a taxonomy as the title. But how would i check ...
5
votes
2
answers
3k
views
WP_List_Table Inside Metabox Not Working on Submit
I'm trying to display a WP_List_table inside a metabox. The metabox is for a custom taxonomy called service which is registered to a custom post type called office. The table columns contain input ...
0
votes
0
answers
186
views
WP_List_Table Inside Metabox With Bulk Actions Not Working on Submit
I'm trying to display a WP_List_table inside a metabox. The metabox is for questions which are from assessment_question custom post type.The metabox is being displayed on an other custom post type '...
1
vote
1
answer
117
views
Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
I'm currently working on a website that has a custom post type ("schedules") that requires custom hierarchal taxonomies (named "location" and "servicetype" in this case) to be displayed as radio ...
0
votes
1
answer
78
views
how to prevent added meta box from being injected with style="position: fixed; top: 56px;" at scroll down
This is my first attempt to customize WordPress.
I added a meta box like this
function settings_metabox() {
//register custom meta box
add_meta_box("mybox-id", "Settings", &...
1
vote
0
answers
108
views
Save Meta when custom Taxonomy Saves
I am in need of some advice, we are setting up a custom tag for Movies. We want to have it pull from the OMDB Api when it is saved. We have the function setup, but it is not firing, and I am stumped.
...
1
vote
3
answers
1k
views
Change Metabox Title
Anyone know of a way to change the title of the core Wordpress metaboxes on a post edit screen? I'm trying to alter the title of the "Featured Image" metabox and have found a way to edit the contents (...
1
vote
1
answer
36
views
can i fetch a custom metabox data in another page or post type?
I need to fitch a metabox field data in another page ,
$headabouttitle1 = get_post_meta(get_the_id(), 'head_title1', true);
this is how i fetch it in the same page , I need to fitch it in another ...
0
votes
1
answer
442
views
Saving a Custom Post Type with a Meta Box results in a "Updating Failed" error
I have a Custom Post Type (Favourites) which I plan on using to talk about my favourite craft products. The meta box field I want to have is a link to an online store listing, so users can buy the ...
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.
...
0
votes
0
answers
25
views
how to update post content field in wordpress
i have used add meta boxes to customize page content and use wp_update_post to save it.
when im creating new page in wordpress it inserts two new record in wp_posts table.
one of them has published ...
0
votes
1
answer
827
views
save metabox with new values _wp_page_template
I created a metabox to display the page templates and select a different one with a radiobutton selection. This is a replacement for the current page attributes metabox.
I'm missing something with ...
0
votes
2
answers
6k
views
How can I remove this sidebar from my Search Results page?
I don't want to display this particular sidebar on my website's search results page because it displays details (SITE ADMIN, Wordpress.org, etc) which I want to hide from the user.
How can I hide or ...
0
votes
0
answers
37
views
Preset custom fields
I'm creating a wordpress plugin which will create a custom post with custom fields like "time", "rating" etc whose will be fillable in admin. So far all tutorials I've seen only ...
5
votes
1
answer
736
views
Remove unusable metaboxes in nav menu management screen
When you visit wp-admin/nav-menus.php and there is no menu you get a set of metaboxes you cannot use. The only thing they do is drawing attention away from the Create Menu dialog.
I want to hide ...
1
vote
1
answer
1k
views
update post meta for checkbox in the admin when inserted in the front-end
Here's my problem, I allow a certain user type to create custom post type in the front-end of my site, with the wp_insert_post() function... users can put values within a form and there's couple of ...
2
votes
1
answer
3k
views
How can I create a custom meta box to add an mp4 video to a page?
I've cobbled together code (as I'm a php and jquery newbie) from a couple of different posts to try and get an mp4 video URL input field in the wordpress admin. I've been able to get a media uploader ...
0
votes
1
answer
101
views
submit two file input fields in the same form
I have a form which has two file input fields, each input should be submitted in different metabox in custom post type, when I try to submit the form it takes only the first one and ignore the second ...
0
votes
2
answers
6k
views
Front end post and upload file, image for users without plugin
There are multiple users who have to post their own post on respective post types (like news, reports etc) with feature image upload, extra file (pdf, txt, excel) upload button from the front end ...
0
votes
0
answers
255
views
Adding accordion-section to custom post type edit screen
I'm trying to add accordion-style meta boxes to the edit screen of a custom post type on the right hand side beneath the "Publish" meta box.
Actually I'm kind of trying to replicate the Menu ...
6
votes
1
answer
4k
views
Can you make a custom metabox field be required to save a new post?
I am working on a custom post type, I have removed all the standard wordpress form items and started from scratch with custom meta boxes, except the title field.
In my situation, it is really ...
1
vote
1
answer
2k
views
How do I update a field of a meta box?
While parsing data from a CVS file into a custom post type, i would like to parse data into the fields of a meta box, that I created.
The meta box fields are normally updated like this:
function ...
1
vote
0
answers
51
views
Unsaved changes in metabox inputs not detected in the block editor
I have added a custom field to the regular WP post type and added a meta box to the post editor as below (it is just an example with trivial checkbox):
add_action( 'add_meta_boxes', '...
0
votes
2
answers
1k
views
Starting with tabbed metabox
I need a tabbed metabox for my plugin.
Actually they are 5 metaboxes each one in a tab.
I found these scripts:
https://speckyboy.com/10-simple-code-snippets-creating-beautiful-tabs/
Which one is ...
0
votes
2
answers
833
views
Creating alternate meta box context locations
I am trying to create two additional add_meta_box context locations ('after_title' and 'after_editor') within posts.
This doesn't appear to do what I think it should. The meta box does appear on the ...
0
votes
1
answer
54
views
I'm having trouble with Related Product "tax_query" 'terms' value
I have two custom page types. the first is "product" and the second is "accessories". On the product page, there is the accessories category "inputs" raleted post. Inputs ...
4
votes
2
answers
33k
views
How to add multiple images to custom post type?
I would like to create a simple plugin to add multiple images to a custom post type. I have created a plugin to add a single image to a custom post type, but I am unable to figure out how to add ...
0
votes
2
answers
223
views
Show meta box only for default page template
I'm having an issue with one of my meta box. I want the meta box displayed only on the default page template editing page.php.
The meta box doesn't show up on the editing page.
add_action('...
0
votes
2
answers
4k
views
Adding an extra parameter [string] to my posts' permalink?
I've been searching the internet for 6 hours now, so I decided to ask this in the forum and would appreciate every help.
I just want my permalink to say (e.g. portfolio, post, etc)
http://mysite.com/...
1
vote
2
answers
935
views
Meta box html is not updating after saving
I have some meta boxes setup, some are my own, some are initialized in plugins.
As the title indicates, these meta boxes are not updating graphically after the post has been submitted.
Here's an ...
3
votes
1
answer
734
views
add_meta_boxes action with refresh on save
I've created a meta box using add_meta_boxes action and it works when I open any post to edit it.
add_action('add_meta_boxes', function() {
add_meta_box(
...
);
});
When WP auto ...
0
votes
1
answer
1k
views
Illegal string offset in PHP function
I'm creating a metabox to upload PDF files.
I have the following warning notice for this line of code: $this_file = $filearray['url'];
Warning: Illegal string offset ‘url’ in...
The complete function ...
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?
0
votes
0
answers
82
views
Display metabox galleries on specific page template in admin editor
I'm building a Wordpress website with two metabox galleries displayed only on post type page in admin editor.
What I'm trying to do is to display them only for a specific template page in the admin ...
0
votes
0
answers
160
views
Add metabox to pages that use custom template in WordPress
I am trying to add custom metaboxes to only those pages that use a certain custom template that is applied to them.
How can i do this? I based on this this guide:
How to add add_meta_box to specific ...
1
vote
0
answers
258
views
How to use custom form on add_meta_boxes callback
I am trying to trigger the echo when the form button will click.
but not able to do this. if I don't use form and direct echo there. this is working. but when I use a form, it's not working.
can ...
0
votes
1
answer
80
views
How to 'clone' select metabox options with a callback function? [closed]
Here is my metabox
array(
'id' => 'all_btns',
'name' => 'Button Select',
'type' => 'select',
'options' => array(
'button' =&...
0
votes
1
answer
39
views
WP nonce field checkbox prints checked='checked' outside input field
I'm currently creating a custom post type in wich I want to add some custom meta boxes. All the fields just go as expected excepting a checkbox field wich prints on the html checked='checked' after ...
0
votes
0
answers
237
views
Render metabox gallery in frontend
I'm building two metabox galleries on the same page with the help of a tutorial. The code works fine. However the galleries are automatically displayed after the content on the front end.
What I would ...
0
votes
0
answers
429
views
Making custom meta box required (with error message if not filled in) on Gutenberg
<input required name="myName" type="text" value="<?php echo $myValue; ?>" class="regular-text">
Does not produce an error message if the field is ...
0
votes
0
answers
312
views
HTML for adding a meta box (basic text field) to page editor?
I am following this tutorial from to add a meta box to pages of a certain page template.
Unfortunately the code omits the part on how to create the actual meta box on the page (the HTML).
The code in ...
0
votes
0
answers
49
views
Remove Username and just show Name in Author Metabox in backend
In the Author Metaboxes for Posts / pages / custom types, it shows: Name (Username)
Is there anyway to customize this to just show Name only? Or maybe Name and Role?
I am pretty sure if it done with ...
3
votes
2
answers
9k
views
How to pass variable via $callback_args for add_meta_box
I am trying to pass a variable to the callback function through add_meta_box. I know that there is $callback_args that can be used to pass the variable. But somehow I just can't get it to work within ...
0
votes
1
answer
896
views
How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?
On the Edit Screen in the WP Admin there is a meta box for WP's built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php).
This meta box ...
0
votes
2
answers
4k
views
meta box on new admin page
I created a new page for the homepage settings of my theme using add_pages_page(). On that page I want to use wp.media to let the user select one or several images from the library (or upload new ones)...
-1
votes
1
answer
73
views
Remove action of an external plugin after checking if custom post meta is set
Edit:The problem were 2 folds - somehow the order list I found before indicated wp_head was before wp_enqueue_scripts but that is not the case. Found another more updated one and it is actually right ...