Create a post builder skin in a plugin

You cannot insert the do_action() inside the class like that, it’s gonna give you a fatal error. Instead you could use an array $skins to store all the skin functions (as closures), and the magic method _call() to call them: class skinclass { private $skins = array(); function __construct() { $this->skins = apply_filters( ‘add_skin’, $this->skins … Read more

How to allow Contributors to publish articles after approval

How can I make the contributor rank able to publish an article but have it then require the approval of an admin before it actually gets published to the website? The “Contributor” role already behaves that way: Contributor delete_posts edit_posts read https://codex.wordpress.org/Roles_and_Capabilities#Contributor As you see, that role lacks the publish_posts capability of the role just … Read more

update_option_{$option} not showing old value

You should use pre_update_option_{option_name} filter. Example:- function system_save_number( $new_value, $old_value ) { mail(‘[email protected]’,’here’,print_r($old_value ,true) . “\n\n” . print_r($new_value,true)); return $new_value; } function system_init_actions() { add_filter( ‘pre_update_option_system_number’, ‘system_save_number’, 10, 2 ); } add_action( ‘init’, ‘system_init_actions’ );

Set post tags using tag ID

For non-hierarchical terms (such as tags), you can pass either the term name or id. If you pass the id there is only one caveat: You must pass it as an integer, and it must be in an array. This is necessary because any non-array value passed will be converted to a string, which will … Read more

Integrate Algolia to WordPress site

This is just a normal plugin. You can install it by doing the following: On the Github Page click “Download Zip” button on the right side. On your WordPress admin panel navigation to Plugins Click “Add New” button at the top of the page which will take you to the “Add Plugins” page. Click “Upload … Read more