custom post type with metabox custom fields
custom post type with metabox custom fields
custom post type with metabox custom fields
Try adding this save function to see if it saves data function save_custom_artiesten_metabox_on_reload() { global $post; if (isset($_POST[‘oa_datum’]) && isset($_POST[‘oa_aanvang’]) && isset($_POST[‘oa_locatie’]) && isset($_POST[‘oa_toegang_prijs’])) { update_post_meta($post->ID, ‘oa_datum’, sanitize_text_field($_POST[‘oa_datum’])); update_post_meta($post->ID, ‘oa_aanvang’, sanitize_text_field($_POST[‘oa_aanvang’])); update_post_meta($post->ID, ‘oa_locatie’, sanitize_text_field($_POST[‘oa_locatie’])); update_post_meta($post->ID, ‘oa_toegang_prijs’, sanitize_text_field($_POST[‘oa_toegang_prijs’])); } } add_action(‘admin_init’, ‘save_custom_artiesten_metabox_on_reload’);
sanitize_textarea_field() will be stripping out the GMaps <iframe> element. Sanitize it with wp_kses( $store_map, $allowed ) instead, where $allowed is an array in the following format: $allowed = array( ‘iframe’ => array( ‘width’ => array(), ‘height’ => array(), ‘style’ => array(), ‘loading’ => array(), ‘allowfullscreen’ => array(), ‘referrerpolicy’ => array(), ‘src’ => array() ) ); … Read more
Your code is correct and is ready for a number field. To make it work for a checkbox, you just need to change the type attribute of the input element from number to checkbox and manage the checkbox state. I think this should work: add_action( ‘add_meta_boxes_post’, “spiaggia_add_meta_box” ); function spiaggia_add_meta_box(){ add_meta_box( “spiaggia_meta_box”, __( “Checkbox Title”, … Read more
The wp_dropdown_categories function provides the HTML for a list of taxonomy terms based on the values assigned to its parameters. That is all it does. When users select a value from the taxonomy selector, the selected value is not saved to the database unless the developer saves it. As the developer, you need to decide … Read more
How to consume external API from WordPress post editor and display the response data in the custom field?
Solved it here is the answer add_action( ‘manage_shop_order_posts_custom_column’, ‘delivery_company_order_column_content’, 10, 2 ); function delivery_company_order_column_content( $column, $post_id ) { if ( $column === ‘delivery_company_order’ ) { $order = wc_get_order( $post_id ); $delivery_company = get_post_meta( $order->get_id(), ‘delivery_company’, true ); $delivery_company_name = get_the_title( $delivery_company ); echo $delivery_company_name; } } add_filter(‘manage_edit-shop_order_columns’, ‘delivery_company_order_column’); function delivery_company_order_column($columns) { $columns[‘delivery_company_order’] = ‘Delivery Company’; … Read more
For anyone who stumbles across this, I finally found the answer in this previous post: How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts? I wasn’t finding it because it’s the Walker class, not a hook.
You are getting that fatal error because your custom mdb_save_metaboxes function is expecting to receive 3 parameters (function mdb_save_metaboxes($post_id, $post, $update)), but WordPress only passed 1 parameter, because you did not tell WordPress that it needs to pass 3 parameters. So to fix the issue, set the fourth parameter for add_action() like so: // If … Read more
Is there a way to remove the Add boxes from the Screen Options menu metabox?