How to disable specific wordpress plugins from automatic upgrade

Sometime there is need to use some plugins in an application and you have the need to customize it UI or functionality to meet your business requirements.

You install the plugins and make the necessary changes to meet the configuration.

Few week later, you discover that your plugins has lost it custom formatting and the custom workflow due to recent upgrade of the plugins version.
Huhh, now what to do.

Option 1: You may look into your past backupfile to restore the plugins from your back up folder to restore the customized codes. This could be risky or not feasible. For example you may not be having the backup of the plugin , secondly you might get it but may be confused on which version you have to restore, because you had made many backup folder.

Option 2: The recommended way is to disable you customized plugins to get auto upgrade. What you need to do is put this below code in your theme functions.php file.

function disableSpecificPlugins( $value ) {
if( isset( $value->response[‘plugin-folder-name/plugin-name.php’] ) ) {
unset( $value->response[‘plugin-folder-name/plugin-name.php’] );
}
return $value;
}
add_filter( ‘site_transient_update_plugins’, ‘disableSpecificPlugins’ );

Here:

“plugin-folder-name” => plugin folder name

“plugin-name.php” => plugin main file. In most cases , the file name is same as plugin folder name. But it can also be index.hp

Add default blank value for select option in contact form 7 wordpress

Normally when you use contact form 7 plugin , for dropdown select option, there is no option to set blank value for the first option to validate the select field.

For example, what we have in wordpress contact form 7

<select name=”your_field_name”>
<option value=””>—</option>
<option value=”yes”>Yes</option>
<option value=”no”>No</option>
</select>

But in actual scenario, i want to display the label for the first option as “–Select Value–” with empty value.
To make the same change, you can use the dropdown code as below
[select* your_field_name_ class:form-select class:required first_as_label “–Select Value–” “Yes” “No”]

In the above code “first_as_label” is important parameter. It instruct the plugin to use the first option as label with default empty value. So the generated output look as below

<select name=”your_field_name”>
<option value=””>–Select Value–</option>
<option value=”yes”>Yes</option>
<option value=”no”>No</option>
</select>

If you have any queries, you can write back to us or comment in the comment section.