How to pass conditional array to wp_localize_script

Ended up with this as the function: // set up the settings for the theme.js function mb_scripts_settings() { // blanks $mb_ajax_form_type = $mb_get_page_slug = $mb_redirect = $mb_redirect_time = $mb_form_disable = $mb_array = ”; // get the form type $mb_ajax_form_type = ( is_front_page() ? ‘change’ : ‘submit’ ); // get the page slug from ID $mb_get_page_slug … Read more

sanitize POST arrays

You can use array_map like this: $room_types = isset( $_POST[‘room_types’] ) ? (array) $_POST[‘room_types’] : array(); $room_types = array_map( ‘esc_attr’, $room_types ); // Replace esc_attr with your desire sanitization

Display a CPT based on a metabox selection

I got it to work by using the following code function get_gas_options($a) { $args = array( ‘post_type’ => ‘fleet’, ‘orderby’ => ‘ID’, ‘post_status’ => ‘publish’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1 // this will retrive all the post that is published ); $result = new WP_Query( $args ); $title_list[”] = “Assign a Vehicle”; if ( … Read more

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