download_url() appears as grey icons

When using the wp_handle_sideload function then, as @xvilo pointed out in a comment, it isn’t creating the meta data wordpress needs to display the image in the media library. As I can not see where the wp_handle_sideload function is writing the data to the db, I don’t understand why the files are being displayed in … Read more

Insert array data on plugin activation

You may please use this code that will help you to insert data into database register_activation_hook( __FILE__, ‘my_plugin_create_db’ ); function my_plugin_create_db() { global $wpdb; $table_name1 = $wpdb->prefix . “woo_currency”; $curr_name = array(‘Dollars’, ‘Ruble’, ‘Riel’); $curr_symbol = array(‘$’, ‘p.’, ‘៛’); $insert = $wpdb->insert($table_name1, array( ‘name’ => $curr_name, ‘symbol’ => $curr_symbol, ),array(‘%s’, ‘%s’)); } Hope this will … Read more

$content variable – Is this a reserved variable for a WordPress function? – php / wordpress

$content – is not reserved in WordPress, it can be used. In the function the_content () – a variable is used, but it is only available in this function. The code of the function itself: https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/post-template.php#L230 Scope of variables in php: http://php.net/manual/en/language.variables.scope.php

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