New answers tagged

0

Your code looks correct to me, so I suspect there is some kind of issue connecting to the second database. Try the following which will log the last error: $wpdb->show_errors(); if($wpdb->last_error !== '') : $wpdb->print_error() endif; If you are using multisite, then you will also need to add: define( 'DIEONDBERROR', true ); Have a look ...


0

I think using the pre_get_posts action should do the trick. Something along these lines. Modify as needed. Add to functions.php. function my_limit_admin_posts($query){ if ( is_admin() && $query->is_main_query() && 'your_post_type' === $query->get('post_type') && current_user_can('some_capability_or_role') ) { $query->...


0

You can use meta_query property when fetching post data using new WP_Query() $vehicles = new WP_Query([ 'post_type' => 'vehicle', 'meta_query' => [ 'relation' => 'AND', [ 'key' => 'wheel', 'value' => '4', ], [ 'key' => 'color', 'value' => 'blue',...


0

For anyone stumbling across this now, I might have the solution. If you've tried the above steps provided by OP, instead of matching the database functions lower the db_version value in the wp_options by 1. In case your $wp_db_version in your version.php is 45805 (as was the case for me), try setting your db_version value in the wp_options table to 45804. ...


0

My suggestion is to register the activation and deactivation hook outside the class definition. /* * Fired during plugin activation. **/ class My_plugin_activator() { public static activate() { // write your db code here } } . /* * Fired during plugin deactivation. **/ class My_plugin_deactivator() { public static deactivate() { ...


0

i have seen some ware a query to fetch products image from database. may be it will help you. just set required parameters as per your requirement. SELECT p.ID,am.meta_value FROM wp_posts p LEFT JOIN wp_postmeta pm ON pm.post_id = p.ID AND pm.meta_key = '_thumbnail_id' LEFT JOIN wp_postmeta am ON am.post_id = pm.meta_value AND am.meta_key = '...


0

Via Velvet Blues Update URLs Plugin You can also use the Velvet Blues Update URLs plugin. After installation, go to Tools> Update URLs. In the Old URL field we enter what we need to change, and in the New URL we enter what we need to substitute. As a result, you can change the permalinks from linking and to the site’s pictures, to relative ones.


0

For my part, it was different from the other answers. My database was set correctly to http://localhost but I had a plugin installed to manage SSL (Really Simple SSL). So I renamed the folder /wp-content/plugins/really-simple-ssl to something different and it worked. And to access /wp-admin without SSL, you need to change your /wp-config.php file and set ...


Top 50 recent answers are included