Getting RGBA colour from gutenberg colourpicker

If you mean wp.components.ColorPicker which is based on react-color, then the tint object also contains a rgb property with an object of the RGBA value like {r: 51, g: 51, b: 51, a: 1}. So in your code, you can use: style={{ backgroundColor: `rgba(${tint.rgb.r}, ${tint.rgb.g}, ${tint.rgb.b}, ${tint.rgb.a})` }} And an easy trick to know all … Read more

Need Old Version of plugins

If you are looking for old versions of a plugin in the WordPress repository (like WooCommerce), you can go to the plugin’s page on WordPress.org/plugins, then look in the right column under the plugin’s Tags for the link to “Advanced View”. Click on that, then scroll all the way down and select from the dropdown … Read more

Randomize attachment IDs

For attachment posts, the following should do it, i.e. use the wp_insert_attachment_data hook along with get_post(): function my_random_post_id( $data, $postarr ) { // Runs if the post is being created and not updated. if ( empty( $postarr[‘ID’] ) ) { // Locate a yet-unused ID in the (wp_)posts table. do { // Based on the … Read more

WP_Query ordering numbers as letters

To evaluate a meta value as a number, use meta_value_num. Try: $args = array( “fields” => “ids”, “meta_key” => “jogador_oficial”, “meta_value” => true, “meta_query” => array( “relation” => “AND”, “query_one” => array( “key” => “quantidade_corretas” “orderby” => “meta_value_num”, “order” => “DESC” ), “query_two” => array( “key” => “tempo_total” “orderby” => “meta_value_num”, “order” => “ASC” ), … Read more

How to make a custom field as an editor in wordpress?

Naren, The actual set-up for the classic/TinyMCE editor is relatively straightforward, I have updated your wordpress_register_fields() function with the necessary lines. For wp_editor() to work you need to get the content if there’s any saved, id the field and then provide settings arguments. (https://developer.wordpress.org/reference/functions/wp_editor/) function wordpress_register_fields() { global $post; // Nonce field to validate form … Read more

Keep custom fix in a plugin

As @kero noted, your best option is to contact the developer and ask if they are open to including an appropriate hook – what you need is a filter to allow customization for the value of $allowed. However, barring that, one potential (albeit not perfect) solution is to ignore updates for the plugin. You can … Read more

Make id column as AUTO INCREMENT on plugin activation

Add the autoincrement keyword after `id` int NOT NULL: public static function activate() { global $wpdb; $sql = “CREATE TABLE `{$wpdb->base_prefix}employee` ( `id` int NOT NULL autoincrement, `name` varchar(255) NOT NULL, `dob` date NOT NULL, `gender` int NOT NULL, `email` varchar(255) NOT NULL, `joining_date` date NOT NULL, `address` varchar(255) NOT NULL, `salary_package` int NOT NULL, … Read more