How to connect to AWS RDS external database (not for the core WordPress db)

I was able to get a working connection using the following code: function test_connect_to_db() { $servername=”thedatabase.0000000000.location-1.rds.amazonaws.com”; $username=”username”; $password = ‘password’; $dbname=”database”; // Create connection $conn = new mysqli( $servername, $username, $password, $dbname ); // Check connection if ( $conn->connect_error ) { die( ‘Connection failed: ‘ . $conn->connect_error ); } $sql=”SELECT id, firstname, lastname FROM table”; … Read more

PHP/MySQL issues when running WP on EC2 cloud [closed]

Try logging into the mysql instance from the command line by typing in mysql -u root -p and then entering your mysql root password. If you can connect, even if it rejects your username and password, you know it’s up and running correctly. From that point you can diagnose whether it is username/password issues or … Read more

How To install AWS SDK for PHP in wordpress?

Install Amazon Web Services Plugin. (https://wordpress.org/plugins/amazon-web-services/) Add all the required keys, at the AWS menu that now should be available in your WP dashboard. Include the library in your code, in my case was: require ‘/path/to/plugins/amazon-web-services/vendor/aws/aws-autoloader.php’; Enjoy!

Enqueue AWS Script

Try to save jQuery.noConflict(); as jquery-no-conflict.js. Then enqueue everything with proper dependencies: <?php function img_scripts_with_jquery() { wp_enqueue_script( ‘jquery-no-conflict’, ‘path/to/jquery-no-conflict.js’, array( ‘jquery’ ), ‘version’, true ); wp_enqueue_script( ‘aws-cba’, ‘https://images-na.ssl-images-amazon.com/images/G/01/cba/js/common/cba_shared.js’, array( ‘jquery-no-conflict’ ), ‘version’, true ); wp_enqueue_script( ‘aws-merchant-cart’, ‘https://images-na.ssl-images-amazon.com/images/G/01/cba/js/shoppingcart/merchant_cart.js’, array( ‘jquery-no-conflict’ ), ‘version’, true ); } add_action( ‘wp_enqueue_scripts’, ‘img_scripts_with_jquery’ );

Securing my WordPress Files and Directories

Why would you want to protect them all? Not all of them need protecting, in my humble opinion. In any event, these are good to have in your .htaccess file: 1: restrict access to wp-config.php <Files wp-config.php> order allow, deny deny from all </Files> 2: restrict access to .htaccess itself <Files .htaccess> order allow,deny deny … Read more

Using audio shortcode for .mp3 URLs with a query string

The problem: The problem seems to be that wp_check_filetype() doesn’t recognize mp3 files with GET parameters. Possible workarounds: You have two options as far as I can see: 1) Override the audio shortcode with the wp_audio_shortcode_override filter. 2) or allow any audio extensions via the wp_audio_extensions filter. Here’s an example how you can implement the … Read more