Hide custom metabox value from custom fields

Custom fields or post meta entries can be hidden from the by default in WordPress available »Cutom Fields«-Metabox by prefixing them with a underscore – _ – as noted here. As addition, if you want hidden fields to be visible during development you can do that easily – take a look at this answer to … Read more

How to add metabox ONLY to specific WooCommerce product type [closed]

You should be able to get the current product id using the using the $post global variable and use that with the WooCommerce function get_product() to the the product object and test its product type. public function __construct() { add_action( ‘add_meta_boxes’, array( $this, ‘add_meta_box’ ) ); } public function add_meta_box( $post_type ) { $post_types = … Read more

MetaBox with Editor instead of textarea – html not saved [closed]

I have solved this problem after many researches, just comment two lines in meta_box.php file at end. $sanitizer = isset( $field[‘sanitizer’] ) ? $field[‘sanitizer’] : ‘sanitize_text_field’; to //$sanitizer = isset( $field[‘sanitizer’] ) ? $field[‘sanitizer’] : ‘sanitize_text_field’; at line 692 and $new = meta_box_sanitize( $new, $sanitizer ); to //$new = meta_box_sanitize( $new, $sanitizer ); at line … Read more

Adding jQuery datepicker to Custom Post Type Metabox [closed]

To properly work I didn’t write my js file like you. My code will only stand for admin side not the frontend. In the js enqueue js file (date-picker.js): jQuery(document).ready(function(){ jQuery(‘.ads_datepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ }); }); I enqueue my script like this add_action( ‘admin_enqueue_scripts’, array($this, ‘enqueue_date_picker’ ) ); public function enqueue_date_picker(){ wp_enqueue_script( ‘date-picker-js’, plugins_url(‘/js/date_picker.js’, __FILE__), array(‘jquery’, … Read more

Global Variable vs Local Variable

As @Milo pointed out, when you use code in OP $post_types is undefined inside the function, so WordPress will act just like it was not there at all. However, that means you are using an undefined variable, and if turn WP_DEBUG on you’ll see a warning, and so you can notice you are doing something … Read more