REGEXP_REPLACE in post_contet

Ok, if someone in the future also needs something like this, I found the solution after some time of playing with regular expressions. This worked for me: UPDATE `wp_posts` SET `post_content` = REGEXP_REPLACE(`post_content`, ‘https:\/\/www\.example\.com\/magazin\/(.*?)\/”>’, ‘https://www.example.com/magazin/\\1″>’); Example in action can be seen here: https://regex101.com/r/3ZPylJ/1 Hope it helps! Smile to all 🙂

Can Anyone provide an example of RAW SQL for SELECTING posts by 2 or more tags

You seem to be catching wrong query. Dumping SQL for such URL (via posts_request filter) get me this: SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (93) AND tt1.term_taxonomy_id IN (94) AND wp_posts.ID IN ( SELECT … Read more

How to export 2 week’s worth of posts

The native import/export tool can do most of this, though I don’t think it will grab all the author profile information (not sure on that – I know it doesn’t bring over passwords, but it might bring the rest). In the WP admin panel go to Tools > Export and walk through the various option … Read more

post id not displaying

You call your header.php file by calling get_header() function in single.php file. It means that your $postid_profile variable exists only in scope of get_header() function. To make it visible in global scope you need to make your variable global. So your code should be modified like this: ### get the author info global $current_user, $postid_profile; … Read more

How to delete ALL comments from certain category in WordPress database?

The wordpress database seems fairly straight forward and is extremely well documented: http://codex.wordpress.org/Database_Description It seems to me that all the category information is stored in the table wp_term_relationships. So you should select from the comments table, join it with the posts table and then the term_relationships table in order to get the category for each … Read more

wpdb prepare sql problem

To get a % character into your SQL string without confusing sprintf() add it to the replacement string: $alabala_sql = $wpdb->prepare( ” SELECT * FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id=tt.term_taxonomy_id INNER JOIN $wpdb->terms t ON t.term_id=tt.term_id and t.slug= %s WHERE p.post_title LIKE %s AND … Read more

Help me SELECT thumbnail from SQL and use

You do not need to be messing with the database connection. WordPress provide a database object called $wpdb. It is not really clear what you are doing. Your title reads “help me select thumb”, but your code is actually pulling a lot of different post statuses, not thumbnails. In fact, your code does not have … Read more