Merge meta_value’s into a single row and then loop

It would appear simply un-serialising works: $results = $wpdb->get_results( $sql_str ); foreach($results as &$result) { $result-> my_custom_meta_values = unserialize($result-> my_custom_meta_values); } If anyone can suggest a more efficient way to do this, I’d be interested.

get second ID from array

Your function is called “replace_thumbnail” so I am assuming you are trying to set/replace the post thumbnail (featured image): function replace_thumbnail($id) { $image_ids = array(); $media = get_attached_media( ‘image’, $id );; foreach($media as $item) { $image_ids[] = $item->ID; } // insert your featured image if (!empty($image_ids[1])) { update_post_meta( $id, ‘_thumbnail_id’, $image_ids[1] ); } // $image_ids_str … Read more

Complex Taxonomy scheme

Set your system up like this: locations – CPT administrative – hierarchical taxonomy natural – hierarchical taxonomy type – non-hierarchical taxonomy In the administrative taxonomy, you would create your tree: countries on the first level, regions second, departments and so on. Then, you would assign your locations to the smallest administrative denominations among your taxonomies … Read more

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