Using wp_filesystem in Plugins

Few things to explain here: In that tutorial, I only chose the upload_dir as an example of how to do it. A demonstration of how the WP_Filesystem functions work. Normally you would not use the WP_Filesystem to write to the upload directory. That code is not meant to be copy-pasta’d into live production code. Writing … Read more

WordPress updates defined vs add_filter?

Skimming through the Core_Upgrader::should_update_to_version() method, it looks like we can override the defined( ‘WP_AUTO_UPDATE_CORE’ ) // true (all), false, minor check, used to setup the local boolean variables$upgrade_dev, $upgrade_minor and $upgrade_major, with the following filters: … apply_filters( ‘allow_dev_auto_core_updates’, $upgrade_dev ) … apply_filters( ‘allow_minor_auto_core_updates’, $upgrade_minor ) … apply_filters( ‘allow_major_auto_core_updates’, $upgrade_major ) … So these filters have … Read more

Register custom query args parameter for WP_Query()

After further research I figured out a solution. Given the following WP_Query: <?php new WP_Query( array( ‘s’ => ‘some keyword’, //keyword criterion ‘category’ => ‘some category’, //taxonomy criterion ‘_spec’ => ‘some value’, //custom criterion to be handled by the plugin ) ); ?> You can handle custom parameters using pre_get_posts in combination with posts_where: <?php … Read more

Automatic updates in plugin – not hosted on wordpress repository

You actually have several questions in there, so I’ll answer them one by one: However, if I simply do this on my main plugin file, it doesn’t work: add_filter(‘pre_set_site_transient_update_plugins’, array(‘XYZ’, ‘check_update’)); First of all, I’d like to understand what’s the difference between the two scenarios. This is failing because you are calling the method statically, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)