Worpdress cannot create directory

add this below line to your wp-config.php (if you did not add it yet) define(‘FS_METHOD’, ‘direct’); Check which user run your servers too (not only php7-fpm). ps aux|grep nginx ps aux|grep apache if your server works on www-data then, cd ../your_wordpress_dir/ sudo find . -type f -exec chmod 664 {} + sudo find . -type … Read more

Custom plugin changes not showing

For anyone else with this annoying problem: deactivated and removed plugin from server, moved the plugin file to a new plugin directory folder with a different name, (same plugin name, same shortcode) activated plugin. Now new code being used. No idea why WordPress was holding onto the old code, but now I don’t care because … Read more

edit_{$taxonomy} | Hook

You are getting old version of the term, because edit_{$taxonomy} action is fired after the term is updated but before term’s cache is cleared. Use edited_{$taxonomy} hook, which fires your action after the term is updated and its cache is cleared.

Display content from custom post without modifying the single template

Yes, it’s possible. You’ll need to use the template_include filter. To return a different template for a custom post type of “my_custom_post_type”, you could do something like this: add_filter( ‘template_include’, ‘wpse_272261_template_include’, 100 ); function wpse_272261_template_include( $template ) { if ( is_singular( [ ‘my_custom_post_type’ ] ) ) return PATH_TO . ‘template.php’; return $template; }

Clearing cached plugin data if it is using an external object cache

We note that the Transients API uses the Object Cache API, when we use an object-cache.php drop-in file. For example if wp_using_ext_object_cache() returns true, then get_transient( $transient ) -> wp_cache_get( $transient, ‘transient’ ) set_transient( $transient, $value, $expiration ) -> wp_cache_set( $transient, $value, ‘transient’, $expiration ) delete_transient( $transient ) -> wp_cache_delete( $transient, ‘transient’ ) where the … Read more

How to Create database table when Plugin installed/activated, and delete database when Plugin deleted

Use this code instead- class hidemysite_security{ public function __construct() { if (is_admin()) { register_activation_hook(__FILE__, array( $this, ‘activate’)); register_deactivation_hook( __FILE__, array( $this, ‘my_plugin_remove_database’ ) ); } } public function activate() { global $wpdb; $table = $wpdb->prefix . ‘md_things’; $charset = $wpdb->get_charset_collate(); $charset_collate = $wpdb->get_charset_collate(); $sql = “CREATE TABLE $table ( id mediumint(9) NOT NULL AUTO_INCREMENT, time … Read more