All Questions
1,647 questions
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 ...
3
votes
2
answers
9k
views
Why is `add_meta_box` not working?
I'm trying to add some meta fields to a WPSC product using the following code:
/**
* data callback
*/
function abc_callback($object, $box)
{
echo 'callback executed!';
}
/**
* add custom ...
3
votes
4
answers
36k
views
How to get meta box data to display on a page
I am trying to piece together a Metabox with 3 text editor fields for a custom post type.
The box is showing up and appears to be saving on the custom post type entries but I can't get the data to ...
3
votes
3
answers
5k
views
Loading scripts & styles from a meta box callback function
Case:
I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields:
input (basic, hidden, password)
textarea
radio
checkbox
...
3
votes
4
answers
8k
views
custom fields for attachments?
is it possible to add extra fields via the functions.php script for attachments in wordpress?
Tried loads of examples but none seem to work. Worried an existing plugin might be affecting my attempts ...
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( '...
3
votes
2
answers
394
views
esc before saving or before displaying does it matter?
In a lot of how to create a custom meta box tutorials, when saving data, i.e., update_post_meta the data is escaped:
update_post_meta( $post_id, 'city', esc_attr( ucwords( $_POST['city'] ) ) );
...
3
votes
4
answers
3k
views
MetaBox Layout for all users
I was wondering : You are an administrator : when you re-order the layout of your meta-box, in a page, or in a post, this layout is saved with your user profil : for example you drag the category box ...
3
votes
1
answer
19k
views
Creating a Custom Post Types dropdown in a Meta Box
Is it possible to populate a meta box with a drop down list of custom post types? I plan on trying to create a template for a client that will allow them to create a new page in the dashboard, and ...
3
votes
3
answers
2k
views
Block metabox - No expanding, no moving around
I would like to make metaboxes as fixed elements, removing the expand function and the drag-and-drop function.
Any ideas?
3
votes
2
answers
8k
views
How to batch update post content with custom post meta value
I have a custom meta box, using WPAlchemy, in which I am looking to get rid of. However, I would like to get all posts that have a specific custom meta value set, and insert it into the begininning of ...
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 ...
3
votes
1
answer
2k
views
Find callback function for custom taxonomy metabox
I'm looking for a way to move my custom taxonomy metabox (on the right side) to the post area (the middle). I'm aware you can simply drag and drop it, but I want it in the post area by default for new ...
3
votes
1
answer
5k
views
How to add meta box to plugin admin page?
There is the codes.
add_action('admin_menu', 'test');
function test(){ add_menu_page( 'Test plugin', 'Test plugin',
'manage_options', 'test_plugin_options', 'test_plugin_admin_options'
); }...
3
votes
1
answer
2k
views
Category Search functionality on category metabox (wordpress admin)
I have lots of categories on my blog site. When I add new post and select category, I need to scroll down to find the category. Is it possible to add a search category functionality in category ...
3
votes
2
answers
2k
views
How to remove a metabox from menu editor page?
I am not sure if it is much different for any page but I am wondering how to remove a metabox from the appearance>menu page without having to go into the wordpress core files and remove it. Is there ...
3
votes
1
answer
2k
views
Add script to footer - on post editor
How do you add a script on the footer of the post editor ?
I'm adding a meta box under the post editor and I need to include a javascript before the closing body tag (on the footer)
How do I achieve ...
3
votes
2
answers
8k
views
wp_generate_attachment_metadata gives me an empty array
I have a custom post type and a metabox with a file input.
I can insert the attachment, but I can't update the attachment metadata and I don't know how to fix it because I don't receive any error.
...
3
votes
2
answers
12k
views
The correct way of adding TinyMCE editor to custom meta box textarea?
Since Wp 3.2 a lot of changed to TinyMCE and Wordpress and ow I can not find out how to add the Tiny MCE to meta box in Page.
This is how it looks when I am not firing up the MCE
http://screencast....
3
votes
1
answer
4k
views
upload image in a meta box
im trying to implement uploading via a meta box without using the media manager, but i want it to add as a post attachment.
im currently doing it just uploading and saving to the server.
<?php
...
3
votes
2
answers
2k
views
How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?
I want to add metabox to pull list of custom posts and select any two of them on edit or add post screen. And At last when the post is published display them on single post page. Please help me!
Any ...
3
votes
2
answers
4k
views
Move excerpt to always be directly below post content in admin
Sometimes, due to meta boxes added by plugins, the excerpt gets moved down the order in the admin page.
Is there a way I can force it to always be directly below the post content?
Here is the way I'...
3
votes
2
answers
9k
views
How to Use WordPress Color Picker API in Custom Post Type Metabox
I have a Custom Post Type called "Banner" which has a custom Meta box with two advanced fields "Title" (text Field) and "Color" (color Picker).
Can you please let me know how to use the WP Color ...
3
votes
2
answers
5k
views
How to store the value of a custom field dropdown select for post referencing?
I'm trying to reference posts to each other. Editors should have a custom field select list of certain post's titles to link the current post with other posts. I got quite far, I think. The select ...
3
votes
2
answers
394
views
Access the environment of an admin page from another admin page
I've been busy thinking about a problem, and so far I didn't find a solution to it.
The abstract scenario
On admin page A, I would like to print the value of a (global) variable—in the context ...
3
votes
4
answers
21k
views
Add a meta description to home page?
I have the theme Hatch and I can't figure out how to change the meta-description of the home-page. It is not an actual page, it is the default view for posts.
Have searched everywhere for an answer ...
3
votes
1
answer
6k
views
How to get custom metabox image field?
i have custom metabox with the image field, i can upload image from wp-admin to this metabox, metabox code
array(
'name' => 'Burst Image',
'desc' => 'Crop your image to ...
3
votes
3
answers
3k
views
Editing Screen: Make Update or Publish Button Follow The Page
The Problem:
I am currently in the finishing stages of a premium theme I've been developing and all is mostly well. For pages I have a few custom meta boxes for adding in slideshows and other ...
3
votes
1
answer
224
views
Adding an assisting editor box to Post page
I run a multiple author platform and to improve the moderation, I want to add a couple of assisting editors. I want to add a custom box to the Post page where the assisting editor can confirm which ...
3
votes
1
answer
3k
views
Removing custom meta box added in parent theme
I am using a child theme, and wish to change one of the meta boxes defined in the parent theme.
The meta box is for 'pages' only.
I tried using the remove_meta_box in my functions.php, but it has no ...
3
votes
3
answers
3k
views
Add multiple images to a page sidebar
What I am trying to achieve is this:
I have a simple page and I want to dynamically add multiple images to it on the sidebar one underneath another. I was thinking about either using meta boxes, post ...
3
votes
1
answer
6k
views
Why is my custom meta box input not saving
I've added the following function to functions.php to add a custom meta box enabling the end user to input a gallery shortcode. I then intend to use this to place a gallery in a specific place on the ...
3
votes
2
answers
4k
views
Add filter 'wpautop' to meta box textarea
I'm using -this tutorial- to add simple meta boxes to a custom post type. But the textarea meta boxes are spitting out content all as one big paragraph, with no <p> formatting applied.
What ...
3
votes
2
answers
2k
views
How to limit the pages displayed for choosing parent page on page attribute's menu?
I have a site with a lot of pages. I would like to know if there is a method to display only the pages that I want to be displayed on the menu for choosing the parent page.
A lot of them are child ...
3
votes
1
answer
3k
views
Getting the ID of a meta box
I'm wanting to change the display title of a meta box when editing a custom post.
I want to try this solution here:
How to change the title of a Meta Box on a specified Custom Post Type?
Where I'd ...
3
votes
1
answer
6k
views
Need help adding custom field to category
I'm trying to add a custom field for categories. The custom field is a single checkbox. I can get the checkbox to show up on the forms in the create new category and edit category pages but if I check ...
3
votes
1
answer
443
views
What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
I want to insert a custom button between "Publish" button and "Move To Trash" link. What can I use to make this?
Here is a screenshot to make this clearer:
I know I can use jQuery, but I want to do ...
3
votes
1
answer
4k
views
Get all posts from custom post type and insert in select input as metabox
I would like to know if its possible to do something like this. I have Slider custom post type and Services custom post type.
For slider posts I have created a metabox for URL value to display next ...
3
votes
2
answers
712
views
Use meta box value in CPT as post title
This has been addressed in another post, but the solution was too specific to apply here.
My goal is to use a metabox value (ecpt_name) as the post title so that the user only needs to input their ...
3
votes
1
answer
3k
views
How to Make a Categories Meta Box with Hierarchical Checkboxes on Frontend?
My website allows uses to post posts of a custom post type ("place").
I would like to display the same "Categories" meta box seen in WordPress dashboard when you add or edit a post on frontend:
This ...
3
votes
3
answers
922
views
Only show metabox when date-value in other metabox is over?
probably a weird question.
I'm using the custom MetaBox and CustomFields Class by jaredatch on Github.
I have this "event-date" metabox:
$meta_boxes[] = array(
'id' => 'event_date'...
3
votes
2
answers
13k
views
How to grab metabox value in wp_query meta_query key
How would I modify my WP_Query in order to get a custom meta box value instead of a custom field one like I currently do?
This is how my query looks like:
<?php $today = date("Y-m-d",mktime(0,0,0,...
3
votes
1
answer
676
views
Metabox cloning via Admin Ajax call issue
I've created a fairly simple class for handing the creation of metaboxes within wordpress admin.
I've set up the class so that each instance of the class represents an new metabox definition. Each ...
3
votes
2
answers
6k
views
Custom "Publish" / "Update" button &
I'm trying to implement a "publish" button from a custom post type metabox. Everything actually works fine if I either create a new button and manually call submit() or duplicate the regular submit ...
3
votes
2
answers
1k
views
Why can't I hook into save_posts after admin_init?
I'm trying to hook into the "save_post" action from an AJAX callback in my plugin, but it doesn't seem to work. In fact, hooking into "save_posts" only seems to work from a few key action execution ...
3
votes
3
answers
10k
views
Meta Boxes in Front End Post Submission Form
How can I add meta boxes to the front end post submission form? Similar to front end post submission that creates new posts, the form replies should go directly into the post meta boxes.
Meta Boxes ...
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 ...
3
votes
1
answer
2k
views
Add search to list of categories in post editor
I have many categories in my WordPress website. Each time I am adding new post it is very hard to find specific category that I need this time.
It would be much easier if I had search field right ...
3
votes
2
answers
3k
views
how to set default value for checkbox in wordpress
I am facing a problem to set default value for the checkbox field in WordPress.
I have a checkbox input field (metabox) in a custom post. I want the checkbox to be checked by default. and if user ...
3
votes
2
answers
5k
views
how to sanitize checkbox input?
I've added meta box: checkbox on admin edit screen
<input type="checkbox" name="changeposition" />
So how could we sanitize the input came from the checkbox as we do for input type text by ...