Accessing Correct Database to Create REST API Endpoint

You can access another database using the wpdb class and its associated methods. You will need to instantiate a new connection to the other database using the appropriate credentials. Here is the basic code to set up the new connection and query the database: $mydb = new wpdb(‘username’,’password’,’database’,’localhost’); $rows = $mydb->get_results(“<your SQL query here>”); Replace … Read more

How can I make a function work only for desktops and not for mobiles?

WordPress does have a helper function for detecting mobile devices, wp_is_mobile() (untested): if ( ! wp_is_mobile() ) { echo do_shortcode( ‘[meta_gallery_slider arrows=”false” show_caption=”false” show_title=”false” autoplay=”false” slider_height=”450″]’ ); } As Jacob Peattie mentioned, this is unreliable. Better option is to use CSS to show the output only for viewport widths above specified value (untested): PHP: printf( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)