Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress
This is how I approached to solve the problem. I have fixed the issue. From xampp/mysql/backup/ folder i copied all files in to xampp/mysql/data/ That solved the issue.
This is how I approached to solve the problem. I have fixed the issue. From xampp/mysql/backup/ folder i copied all files in to xampp/mysql/data/ That solved the issue.
Your data are possibly corrupt from trying to store multibyte characters that your DB could not correctly represent. MySQL’s utf8 collation isn’t actually UTF-8. You will have to convert your tables’ character sets to utf8mb4 (real UTF-8), and then set the DB_CHARSET constant to match.
I wonder if you’re looking for the core attachment_url_to_postid() function that uses: $sql = $wpdb->prepare( “SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_attached_file’ AND meta_value = %s”, $path ); $post_id = $wpdb->get_var( $sql ); Note the extra meta key _wp_attached_file check compared to your current snippet. If you need to check if an image url … Read more
Make sure your hosting server have installed mysql server, if that’s not case and you are using paid hosting you can always contact your hosting provider for support.
Your question is a little unclear, and arguably several questions in one, and arguably overly broad and unanswerable in this format, but this sounds like exactly the kind of circumstance that Multisite was not meant for (Emphasis Mine): The sites in a multisite network are separate, very like the separate blogs at WordPress.com. They are … Read more
The below code will help you to remove all the post meta’s except the thumbnail of a post. function kv_delete_all_meta_except_featuredimg(){ $args = array( ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_type’ => array(‘attachment’, ‘page’,’post’)); $articles= get_posts( $args ); foreach($articles as $article){ if($article->post_type == ‘attachment’){ $myvals = get_post_meta($article->ID); foreach($myvals as $key=>$val) { if($key == ‘_wp_attached_file’ || $key … Read more
You do not want a simple SQL solution. post_name is used to generate permalinks. If you simply copy the title to the name (slug) you will have spaces and punctuation in the URL, and that is going to be a problem. It will result in broken links. Additionally, you could end up with two posts … Read more
Insert post without actions/hooks
Per comments, you basically have it – just GROUP BY $wpdb->term_relationships.object_id instead; also to be pernickety, you’d use standard (INNER) JOINs rather than LEFT ones: SELECT $wpdb->term_relationships.object_id FROM $wpdb->term_relationships JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id JOIN $wpdb->terms ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id WHERE name IN (394, 396, 988, 666) GROUP BY $wpdb->term_relationships.object_id ORDER BY $wpdb->term_relationships.term_taxonomy_id DESC
MySql DELETE syntax is not very different fiom SELECT, so you can delete from multiple tables using a single query. Taxonomies informations in WordPress are in 3 tables: wp_terms wp_term_taxonomy wp_term_relationships the first 2 contain term / taxonomy informations, the 3rd contains association between terms and posts. The query to delete all tags from WordPress … Read more