how to change location of the plugins & wordpress themes folder

You can’t move only those folders.

You can move the plugins folder in the wp-config.php file:

Quoted text from WordPress Codex:

Set WP_PLUGIN_DIR to the full local path of this directory (no
trailing slash), e.g.

define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/blog/wp-content/plugins' );

OR:

Set WP_PLUGIN_URL to the full URI of this directory (no trailing
slash), e.g.

define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins' );

Quoted text from WordPress Codex:

If you have compability issues with plugins Set PLUGINDIR to the full
local path of this directory (no trailing slash), e.g.

define( 'PLUGINDIR', dirname(__FILE__) . '/blog/wp-content/plugins' );

NOTE: This stuff changes over time and this is an advanced setting. Read the entire linked page before editing and follow the examples set there. Not the one here which may eventually be out of date.


You can move the entire wp-content folder (plugins, themes, uploads, etc.).

Quoted text from WordPress Codex:

Set WP_CONTENT_DIR to the full local path of this directory (no
trailing slash), e.g.

define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/blog/wp-content' );

OR:

Set WP_CONTENT_URL to the full URI of this directory (no trailing
slash), e.g.

define( 'WP_CONTENT_URL', 'http://example/blog/wp-content' );

NOTE: This stuff changes over time and this is an advanced setting. Read the entire linked page before editing and follow the examples set there. Not the one here which may eventually be out of date.