Including a 3rd party library in WordPress which needs to be accessible by wp-config

I’m attempting to use the Defuse encryption library in WordPress: https://github.com/defuse/php-encryption I’m using this guide as a resource for how to implement it: https://torquemag.io/2016/10/storing-encrypted-data-wordpress-database/ My question is, if my wp-config file requires access to a library, where should I put the library and require the file? Long description of problem: In the tutorial it says … Read more

Best practice differences in DB options and wp-config between live, staging and local WordPress environments?

I’ve been using staging sites for years. So I’m not asking about the necessary difference to setup a working staging site such as search replacing URLs, dev version control branches, changing table prefixes etc. I’m asking for differences which improve security, workflow or quality of life. Differences in options or wp-config.php established upon initial environment … Read more

How to move theme directory but not plugins/uploads out of WordPress root directory?

I am trying to set up a few local multisite installs that will share the same themes folder, but have separate upload and plugin folders that will be in the usual places in wp-content. UPDATED: WordPress is installed at /Users/josh/Documents/Websites/themedev.dev/ and I’ve create the new theme directory at Users/josh/Documents/jp-content/jp-themes and put twenty twelve into it … Read more

get_template_directory_uri does not seem to work when defining WP_CONTENT_DIR

I have defined in my config: define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/somedirectory’ ); after Codex: Editing WP Config BUT <?php echo get_template_directory_uri(); ?> prints out: http://dev.domain.com/wp-content/themes/mytheme Even though it should print out http://dev.domain.com/somedirectory/themes/mytheme Has anyone else experienced this or know of a fix? 1 Answer 1 This is how i set my content directory in wp-config.php … Read more

How to change how long items are kept in the trash?

When the trash feature is enabled, the deleted posts are moved to trash and stored there for 30 days. And there is a schedule/wp_cron event that is responsible for removing these posts permanently after that time. Is there any easy way to change that time? 1 Answer 1 You can change that in wp-config (https://codex.wordpress.org/Editing_wp-config.php#Empty_Trash): … Read more

how to use is_admin in wp-config.php

I am trying to choose different databases for admin and user to decrease the load on database. in wp-config.php when i am trying to use the code if(is_admin()) { define(‘DB_NAME’, ‘wp_db’); } else { define(‘DB_NAME’, ‘other_wp_db’); } both databases uses same user name and password. I am getting an error of Fatal error: Call to … Read more