Questions tagged [metabox]
Refers to a box-like reusable user-interface component common in the WordPress backend.
1,634
questions
0
votes
0
answers
20
views
Why is $_POST empty when saving custom Meta Box?
I'm creating a Meta Box in my custom Plugin where the Administrator can select which users can view a certain post based on their roles. When I select the role and save the meta box content by ...
0
votes
1
answer
77
views
Finding the screen id of a page generated with add_menu_page
I'm at a basic level of WordPress + PHP and I'm trying to build a pretty simple plugin.
I've set up the plugin correctly, and the plugin page is generated with
function wpplugin_settings_page() {
...
0
votes
0
answers
14
views
How to avoid saving empty data to sql while using add_meta_box
I'm trying not to save empty data (null) while using add_meta_box function. My code is
/**
* Register meta boxes.
*/
function hcf_register_meta_boxes() {
add_meta_box( 'hcf-1', __( 'Hello Custom ...
0
votes
0
answers
10
views
show a specific metabox dependent on the page template
For a few days I am trying to show a specific metabox dependent on the page template. I can do it but my problem is when I have selected a page template and hit the update button then the metabox does ...
0
votes
1
answer
22
views
Meta Box WP_Query array for showing items with a certain relationship
in oxygen I am using a repeater to show posts that have a certain relationship. The advanced query in the relationship is post_type = "custom post type1" and then I add another parameter ...
1
vote
1
answer
27
views
Send email button in custom post type backend
I've added a button in the backend of my custom post type editor.
I want to send an email using wp_mail() when admin user click a button.
I've added this custom form and button to a meta box. See ...
0
votes
0
answers
32
views
How to set javascript options for select2 in PHP array of plugin
I'm using two different jQuery plugins that I'm trying to get to work together. It should be possible since they come bundled together.
The first plugin is the Metabox.io plugin for creating metaboxes....
1
vote
1
answer
36
views
Save / Show multi line text in metabox
In a plugin I have made (Snup Widget) I have made a metabox.
In the sample here I have made two line with text.
When I want to show the text in output in the widget it shows in one line, without break....
0
votes
0
answers
10
views
Custom Meta box change size
I a plugin that I have made (SNUP Widget) there is a strange error.
When I use widescreen monitor this custom meta box I made looks ok.
But with I open browser on my PC with split screen that is not ...
0
votes
0
answers
10
views
I can not display meta value in extras.php and template-tags.php
I have page template that stores reservation input fields, I would like add link to that specific page using meta box but my meta box doesnt work in extras.php and meta-tags.php, I would like to know ...
0
votes
0
answers
29
views
ACF - Hiding metaboxes through screen settings doesn't work
Hiding ACF metaboxes through screen settings seems to be properly saved in user settings (wp_usermeta.meta_key = 'metaboxhidden_{contentType}):
+--------+-------+----------------------+----------------...
0
votes
0
answers
8
views
Custom Post Type meta data getting deleted on bulk editing taxonomies
I am facing a weird issue while editing custom post types. I created a Custom Post Type and a taxonomy linked to it. Posts are attached to their respective taxonomy terms. I also added some meta data ...
0
votes
0
answers
35
views
Add a Metabox checkbox to the Page Edit screen of wp-admin , which only certain roles can see and Makes only certain roles able to Edit said page
UPDATE Please Read Past my Phases to see development and new questions!
Currently on Phase 3
PHASE 1 - resolved
so far Ive tried to code it myself, and Ive added this into functions.php, but there is ...
0
votes
1
answer
26
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
0
answers
14
views
Checkbox doesn't save inside metabox
I have a repeatable fields metabox which includes a checkbox input.
I have an issue when saving the metabox in the admin. The checkbox value doesn't save.
Here is the PHP code:
<?php
add_action( '...
0
votes
0
answers
9
views
Display default matabox of posts(add category) wordpress
I'm trying to make a custom page that will add posts.
And I have a little problem. How can I display adding categories in page(in my template) for a post as in the admin panel
0
votes
0
answers
19
views
Create post meta box that links another post
I have Posts that act as movie reviews. I also have custom post types 'movies' that have detailed information on said movie. What I would like to do is add a custom meta box to the Posts (movie ...
0
votes
0
answers
34
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 '...
0
votes
1
answer
14
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
0
answers
9
views
Select input in metabox not updated
I try to figure it out why my select input did not update the value.
I have placed the select input in the header of a metabox, the same what Woocommerce did with the producttype selector.
...
0
votes
0
answers
35
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.
...
0
votes
1
answer
22
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
1
answer
26
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
24
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 ...
0
votes
0
answers
14
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
0
answers
23
views
meta box pop up upload button wont work
I want to upload multiple images for portfolio, but upload button wont pop up at all, but when I remove PHP codes and add HTML codes instead it works then. I think PHP foreach method has a code error, ...
0
votes
0
answers
16
views
Translate dashboard metabox
I create a dashboard metaboxes for the last published and drafted pages
below the code i use :
#dahsboard metaboxes
#Last edited pages
add_action( 'wp_dashboard_setup', '...
0
votes
0
answers
22
views
Dropdown category field inside repeatable metabox
I'm building a repeatable metabox with different fields in the Page editor: Name, Email, Tag, Categories.
To display the dropdown category field inside the metabox I use wp_dropdown_categories();
The ...
0
votes
0
answers
25
views
Create shortcode for metabox gallery
I have a metabox gallery in a custom post type.
Usually I display the gallery in the front end using the following PHP code in my theme:
$gallery_images_1 = get_post_meta( $post->ID, '_post-metabox-...
0
votes
0
answers
17
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 ...
0
votes
0
answers
21
views
Add metabox if there is at least one post available
So I am building a WordPress Dashboard widget which will showcase all posts & pages where a Gutenberg Block is active.
The below code does it's job and pulls in an array based on get_posts().
Here ...
1
vote
1
answer
238
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 ...
0
votes
2
answers
194
views
How to disable Author dropdown in Gutenberg's Status and Visibility panel
I recently noticed a new feature in the Gutenberg editor (I'm guessing introduced in Wordpress 5.8) that seemingly allows any user to post as any other user:
I confirmed that using this new option, a ...
0
votes
1
answer
41
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
0
answers
90
views
metabox upload multiple file
I have upload multiple file metabox, my problem is I need to display all files links attached to this post inside the post editor. when i upload the files it is already saved under the media but the ...
0
votes
0
answers
95
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 ...
1
vote
0
answers
39
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
1
answer
38
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 ...
0
votes
0
answers
25
views
How to make a complete Meta Box part of a complete Post Type?
I receive the code complete, but I don't know how to make the Post Type loads the MetaBox when creating a new Post, here is the Post Type:
if ( ! function_exists('cpt_campaign_details') ) {
// ...
0
votes
2
answers
59
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
0
answers
35
views
I want to create post inside custom post types
I try to make a theme for Movie Series and I want to create custom post types "Series" with make post "Episode" inside by custom field/metabox. And then url like:
domain/series/...
0
votes
0
answers
23
views
Metabox repeatable fields with select options
In my dashboard admin, I have two metaboxes with repeatable fields in the same page. The first metabox has only one input value $field[tag_filter]. The second metabox has a select tag to display ...
0
votes
0
answers
20
views
Grab data Metabox repeatable fields to display inside other Metabox
In the admin dashboard, I have two Metaboxes with repeatable fields inside the same page.
The first Metabox is a list of names of activities for teachers. Each activities is a row with only one input ...
0
votes
0
answers
15
views
Metabox repeatable fields issue when adding second field
I have a Metabox with repeatable fields. My first input is $field[tag_filter], it works fine.
What I'm trying to do is adding a second input $field[tag_ref]. Unfortunately with the second input the ...
0
votes
1
answer
571
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 ...
0
votes
0
answers
23
views
How to show error message in admin panel using WordPress?
I'm using WordPress and I want to add validation for the save_meta_data function and if the request isn't validated admin panel should show the error message. my code is here:
public function ...
0
votes
0
answers
42
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
30
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
37
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
28
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' =&...