New answers tagged

0

You cant export only categories (or taxonomies generally). Just export all content with Tools/Export and you can delete content except categories from xml.


0

I assume you're already properly using the WP Metadata API https://codex.wordpress.org/Metadata_API to attach the field to new comments and you just want to backfill for existing comments by stuffing the database? If it was my problem, I wouldn't bother and would assume in my code that absence of meta implied no likes. If you use update_meta_data() to ...


2

Is this what you're trying to do? // WP_Query arguments $args = array ( 'post_type' => array( 'project' ), 'meta_query' => array( array( 'key' => 'meta_key', 'value' => '%$query%', ), ), ); // The Query $query = new WP_Query( $args );


1

I'm not an expert but try this one: SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta LEFT JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id WHERE wp_postmeta.meta_key = '%$query%' AND wp_posts.post_type = 'project' it worked for me


0

I would say the problem is first array. Change it to array( 'name' => $_POST['name'] ), You can also use wpdb->show_error() or wpdb->print_error() To Samuel Elh: wpdb->insert() can escape value itself


0

SELECT * FROM wp_postmeta WHERE NOT EXISTS (SELECT * FROM wp_posts p WHERE wp_postmeta.post_id = p.ID)this will find all the broken metadata: SELECT * FROM wp_postmeta WHERE NOT EXISTS (SELECT * FROM wp_posts p WHERE wp_postmeta.post_id = p.ID) But you can probably find a plug-in to cleanup your database ;-)


1

After join term_id exist two times. You should specify which term_id you are querying by prefixing full table name (or alias). Also there is a other error term_taxonomy.term_id = terms.term_id missing table prefix. So the updated query will look like $query = 'SELECT term_taxonomy_id, ' . $wpdb->prefix . 'terms.term_id, taxonomy, name FROM ' . ...


2

Try putting the table name inside quotes, like this SELECT * FROM `sparte-bogensport` Edit More info on why this happens: http://dev.mysql.com/doc/refman/5.7/en/identifiers.html


0

I hope I understand the question correctly UPDATE `wp_postmeta` SET `meta_value` = replace(meta_value, 'old_value', 'new_value') WHERE `meta_key` LIKE 'your_key' EDIT 1 : i forgot to mention : BACKUP YOUR DATABASE BEFORE ANY TRIAL EDIT 2 : following comment : To copy from one field to another (I got a bit confused with your naming and which value you ...


1

Scheduled Post Guardian solved it. I guess scheduling strictly from database is not possible.


1

An alternative, instead of writing SQL queries by hand, is to use e.g.: $post_ids = get_posts( [ 'fields' => 'ids', 'post_type' => 'attachments', 'orderby' => 'menu_order', 'order' => 'ASC', 'post__in' => wp_parse_id_list( $input_ids ) ] ); where the handy wp_parse_id_list() core ...


2

Just use %s for string and %d for digit replacements. Do not forget to use the proper esc_*() functions (use full text search for esc_ in the function reference). global $wpdb; $wpdb->show_errors = true; $wpdb->suppress_errors = false; ! defined( 'DIEONDBERROR' ) and define( 'DIEONDBERROR', true ); $sql = <<<SQL SELECT ID FROM ...



Top 50 recent answers are included