sanitize_post() is not sanitizing Post Object

Solution: sanitize_post is coming with “display” default filter option. And it does not sanitize tags. But if you tries a code like this: $sanitizer = function($post){ return sanitize_post($post, “db”); // or “edit” }; array_map($sanitizer, $data[“post”]); Now it sanitizes fields against XSS!

Add taxonomy column with meta field (ACF) content

As Sally CJ suggest in comments, the error come from the terms with artist_avatar empty. So, check if is_array() before access the array, fix it: add_filter(‘manage_artist_custom_column’, function ($content,$column_name,$term_id){ $term = get_term($term_id, ‘artist’); $avatar = get_field(‘artist_avatar’, $term); switch ($column_name) { case ‘artist_avatar’: if ( is_array( $avatar ) ) { $content = $avatar[“url”]; } else { $content … Read more

Taxonomy terms not properly displaying as array

I found out that I forgot to implode the array values on public function job_dashboard( $atts ) function. Updated code below: private function get_job_dashboard_query_args( $posts_per_page = -1, $post_status = null, $category = null ) { $post_status_array = [ ‘publish’, ‘expired’, ‘pending’, ‘draft’, ‘preview’ ]; if (!$post_status) { // if not set $post_status = $post_status_array; } … Read more

how to get users with usermeta include array of an array

I solved my problem in another way(WPDB). I wrote a query for this purpose like below: $goal_posts = [31289,31422,77641,41289,21482,17641]; $sql = “SELECT * FROM wp_usermeta WHERE (meta_key = ‘saved_posts’) AND (“; $sql .= implode(” OR “, $goal_posts); $sql .= ‘) GROUP BY user_id’; global $wpdb; $users = $wpdb->get_results($sql);

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