Hot answers tagged

5

For the permanent solution, your SQL query is slightly off - you need: UPDATE db1357924680.wp_posts SET post_content = REPLACE( post_content, '[print_me]', '' ) WHERE post_content LIKE '%[print_me]%' MySQL replace example


3

There is an easier way to do this: add_filter( 'the_content', 'my_post_content_remove_shortcodes', 0 ); function my_post_content_remove_shortcodes( $content ) { /* Create an array of all the shortcode tags. */ $shortcode_tags = array( 'shortcode_1', 'shortcode_2', 'shortcode_3' ); /* Loop through the shortcodes and ...


2

Your wp_comments table already has a comment with id "1". You will need to remove the existing entries. If you want to keep them, then remove the "id" field from all comments you're importing.


1

Because $pageposts is an array of post IDs, but you need to pass a post object to setup_postdata - pull the objects instead: SELECT $wpdb->posts.* [rest of query] Note that, since you're not paginating, you don't need SQL_CALC_FOUND_ROWS


1

The direct answer to the question "Is there a way to get 3+ dimensional array from a single MySql command" would be yes - WordPress routinely stores and retrieves multidimensional data from MySQL rows by serialize()ing and unserialize()ing structured data to/from a string format. The Metadata API automatically handles this process when you pass it structured ...



Only top voted, non community-wiki answers of a minimum length are eligible