meta-box | best plugin for WordPress custom fields | Content Management System library
kandi X-RAY | meta-box Summary
kandi X-RAY | meta-box Summary
Meta Box helps you add custom fields and details on your website such as pages, posts, forms and anywhere you want using over 40 different field types such as text, images, file upload, checkboxes, and more. On top of that, each WordPress custom field type has extensive internal options for unlimited content possibilities. Complete customization and control is just a few clicks away. Adding WordPress custom fields and custom meta boxes is quick and painless: Select the field types you want in the user-friendly Online Generator, then copy and paste the code into your child theme's functions.php file. There are also free and premium extensions available to add enhanced capabilities. You can manage the display and organization of your WordPress custom fields, the conditions upon which they appear, and become the ultimate WordPress data wizard. You can also check out the full list of extensions and MetaBox.io for details.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Normalize field arguments .
- Render a map .
- Get sanitize callback .
- Generate field html
- Generate a file field
- Render the meta box .
- Check for updates .
- Enqueue scripts .
- Get file information .
- Ajax request to get users .
meta-box Key Features
meta-box Examples and Code Snippets
Community Discussions
Trending Discussions on meta-box
QUESTION
I am using WordPress. I have created a custom post type. Now I have to add the file upload option so that the admin can upload the pdf.
I have tried some code and I am getting the output and it's correct.
Now, My issue is when I upload the pdf and click on the publish button then it's not uploading. I am not getting any errors. I am using the below code.
...ANSWER
Answered 2021-Dec-16 at 10:50To see if there is attached file to your post edit the following function
QUESTION
According to this post, custom post type, hide or disable the trash button in publish meta box, this is specifically removing for post. I couldn't find any post solutions relating to remove 'Move to trash' under woocommerce order action. Does this code apply same to removing this button on woocommerce?
...ANSWER
Answered 2021-Sep-29 at 13:06To prevent deleting post/order/custom post is capability per user role. To prevent shop_manager role from deleting orders you must remove that capability. All other solutions will visualy work but someone who knows his stuff still can delete order if he wants. So place the following function in your functions.php
QUESTION
I'm currently using the woocommerce-readonly-role this plugin to disable the ability to edit for a specific user where they only are able to view orders instead of editing just for shipping purposes in woocommerce. However, I need to enable some of the buttons to be editable, and I actually have some other features/custom code in the orders and need to enable it to be editable. Hence, in the current plugin I'm using, no matter which features I've added on, it is still unable to edit as I assuming the plugin is disabling the whole 'clickable' button on the order page regardless of additional features I added into order page.
So, I'm planning to be selective on which button is not accessible for the specific user. The main issue is how do I disable edit (only enable readonly) more button / field edit including for shop manager only as below: You image reference may view from here: https://snipboard.io/AtOWBY.jpg
- Disable Add Order (I was following this and added to function Remove or hide "add new" button on woocommerce on bulk order panel using the code below
ANSWER
Answered 2021-Sep-29 at 09:52Use get_current_user()
, this way you can get user object then check user's role from the object and if it is shop manager then apply your code as you mentioned.
QUESTION
I want to limit the Product Short Description, so that only text can be added. (Disable tinymce editor). As there is post excerpt in regular posts.
Current:
- Product Short Description = TinyMCE Editor
Expected:
- Regular Posts Excerpt = TEXT ONLY
From what i found, this is what WooCommerce does to replace the standard excerpt box.
In includes/admin/class-wc-admin-meta-boxes.php on line 119 there is
...ANSWER
Answered 2021-Jun-30 at 11:57You can use the wp_editor_settings WordPress hook in combination with some conditions.
Note that not only 'tinymce'
is set to false, but also 'quicktags'
and 'mediabuttons'
So you get:
QUESTION
I use Gutenberg with WordPress and I would like to check some fields before the user publish his post.
I would like to check if the featured image
, the title
and a simple text field
in a meta-box are not empty.
If a field is empty a notification is displayed and I locked the "Publish" button.
For the moment all works fine with the featured image
and the title
. But when I'm trying to check is the text field in the meta-box is empty I got errors :
ANSWER
Answered 2021-Jun-03 at 00:30That could happen when the XHR/AJAX request that fetches post data from the REST API hasn't been fully resolved, so you can't simply access the metadata like that. You need to ensure that getEditedPostAttribute('meta')
actually returns an object and only then access the _myprefix_text_metafield
property.
So try with this instead:
QUESTION
Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which:
- Adds a Custom SKU Field (ArticleID)
- Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data
- Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders
However, it seems that the last part (for Manual Orders) is causing a conflict with this following other custom code I added for Gateway Fees:
...ANSWER
Answered 2021-Jan-25 at 23:57You need to target only line items on the last function, this way:
QUESTION
{UPDATE}
I want to sort products on backend order details by category menu order. So my categories are Clothing, Decor, Music, and products must be ordered in this way.
I tried with this snippet
...ANSWER
Answered 2021-Jan-17 at 09:22add_filter( 'woocommerce_order_get_items', 'filter_order_get_items_by_categories12', 10, 3 );
function filter_order_get_items_by_categories12( $items, $order ) {
global $woocommerce, $wpdb;
$c1 = $wpdb->get_results( "select t1.order_item_name,t1.order_item_id,t5.name,t2.meta_value from
wp_woocommerce_order_items as t1 LEFT JOIN wp_woocommerce_order_itemmeta as t2 ON t1.order_item_id =
t2.order_item_id LEFT JOIN wp_term_relationships as t3 ON t2.meta_value = t3.object_id LEFT JOIN wp_term_taxonomy
as t4 ON t3.term_taxonomy_id = t4.term_taxonomy_id LEFT JOIN wp_terms as t5 ON t4.term_id = t5.term_id where
t1.order_id = '" . $order->get_id() . "' and t1.order_item_type='line_item' and t2.meta_key='_product_id' and
t4.taxonomy='product_cat' ORDER BY `t5`.`name` ASC" );
$sorted_item_ids = array();
foreach ( $c1 as $data ) {
if ( !in_array( $data->order_item_id, $sorted_item_ids ) ) {
$sorted_item_ids[] = $data->order_item_id;
}
}
$sorete_arr = [];
foreach ( $sorted_item_ids as $value ) {
if ( $items[ $value ] instanceof WC_Order_Item_Product )
$sorete_arr[ $value ] = $items[ $value ];
}
return ($sorete_arr) ? $sorete_arr : $items;
}
QUESTION
On my page-projects.php template page I am outputting image posts from my CPT 'projects'.
I want to add a 'see all' link to my 'archive-projects.php (using: echo get_post_type_archive_link('/projects');), but it's linking to the same page-projects.php that I am on...
- created template page in root called page-projects.php
- in dashboard the page is 'photography' with slug of 'projects' and is assigned project template(page-projects.php) from 'page attributes' meta-box
- CPT is 'projects', and each project is assigned project template(page-projects.php) from 'page attributes' meta-box
- created archive-projects.php in root and in CPT code I have added for archive 'has_archive' => true
Why is it linking to my custom post type page that I am already on and not my custom post type archive page?
...ANSWER
Answered 2020-Oct-22 at 09:25If your page who list projects
slug is projects
AND your archive slug is also projects
WordPress will always display your page.
The archive page need to have a different slug.
QUESTION
I checked WordPress using query monitoring plug and I got this error:
Undefined index: post
the error in plugin n-custom-point
error locations are :
1- wp-content/plugins/n-custom-point/class/metabox-user-group.php:17 prefix_register_meta_boxes() and this is line 17
...ANSWER
Answered 2020-Apr-17 at 10:18This is a PHP Notice, it can be fixed by changing the line from:
QUESTION
I'd like to change the product meta label from "Weight" to "Square Feet" in both the back end and front end.
I've tried this and a few [hundred] variations without success:
...ANSWER
Answered 2020-Jan-22 at 17:53You may use this snippet
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install meta-box
Visit Plugins > Add New
Search for Meta Box
Click the Install Now button to install the plugin
Click the Activate button to activate the plugin
Unzip the download package
Upload meta-box to the /wp-content/plugins/ directory
Activate the plugin through the 'Plugins' menu in WordPress
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page