global $post; in WooCommerce

You should avoid using global variables where possible. For metaboxes you should use the $post variable that is passed to the callback function instead: add_meta_box( ‘supplier_package_box’, __( ‘Supplier’, ‘supplier’ ), ‘populate_meta_box’ ); function populate_meta_box( $post ){ print_r($post); }

Having trouble getting my meta data to save

in nffa_save_meta_box_tags(), you use $mtags, but $mtags is not defined in that function. Manually replacing the two instances of $mtags[‘id’] with ‘NFFA_meta_tags’ makes the value save – showing that’s part of the problem. The other problem is that santize_text_field() has a typo, should be sanitize_text_field().

Unable to show meta box data in frontend

You should be able to display the data mentioned in your question. // use within loop echo get_post_meta( $post -> ID, ‘_listing_overview_content_key’, true ); Example: /** * Setup query to show the ‘car_listing’ post type with ‘8’ posts. * Output is title with excerpt, Listing Overview, Fuel Type an Listing Category. */ $args = array( … Read more

WordPress nl2br is not converting newline to html line break when saving metabox value

From the reference/description of sanitize_text_field(): Checks for invalid UTF-8, Converts single < characters to entities Strips all tags Removes line breaks, tabs, and extra whitespace Strips octets So a simple fix is, use sanitize_textarea_field(): The function is like sanitize_text_field(), but preserves new lines (\n) and other whitespace, which are legitimate input in textarea elements. // … Read more

How can I show/add/save custom metaboxes as an Array of values?

You just have to modify the name attribute of the generated input fields from p_clr to p_clr[]. $_POST[‘p_clr’] will then be an array with the values of all the input fields. public function prod_colors_box() { global $post, $p_clr; $p_clr = array(); $p_clrs = get_post_meta( $post->ID, ‘p_clr’ ); ?> <div id=”p_colors”> <?php foreach( $p_clrs as $key … Read more

Change Metabox Title

The “Right way” to do this is hooking to the ‘add_meta_boxes’ action, like so: add_action(‘add_meta_boxes’, ‘my_metabox_titles’, 10, 2); function my_metabox_titles($post_type, $post) { global $wp_meta_boxes; // array of defined metaboxes // cycle through the array, change the titles you want }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)