WordPress SQL – How to Check for Category?

And I want to add an additional condition that the post be in a specific category. Any thoughts? JOINing on the taxonomy tables is complicated. Unless you have a good reason why you have to use SQL, don’t. Use WP_Query. $args = array( ‘post_type’ => $holder, ‘numberposts’ => -1, ‘post_status’ => array(‘publish’), ‘category_name’ => ‘cat-slug’, … Read more

A change in URL slug in database returns 404, how can I do auto-redirect?

If you look in the database in the $wpdb->postmeta table you will see a meta_key named _wp_old_slug. That is how WordPress tracks slug changes. By editing the database directly you bypassed the mechanisms that create that postmeta entry. You never want to edit the database directly if you can use WordPress Core functions instead. Attempting … Read more

WordPress VIP realpath Alternative?

I don’t know what “wp vip” wants or needs, but you should be loading files by means of get_template_part, locate_template, site_url, or home_url and I am guessing that using one or more of those is what the “scan” wants. It is hard to say exactly which since you posted only the error and not the … Read more

wp_option table error while importing

I was able to solve my own problem, while its was a very struggling effort.If your database is corrupt, but you want to restore your site. Just open your database in a any program like TextEdit, Notepad++ and make sure you copy the basic databases mention here in a new database, that will at least … 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