if ( is_object( $arr['function'] ) && is_callable( $arr['function'] ) ) {
if ( $remove_all_filters ) {
unset( $wp_filter[ $notice_type ]->callbacks[ $priority ][ $name ] );
$class = ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) ? strtolower( get_class( $arr['function'][0] ) ) : '';
// Remove all callbacks except WPForms notices.
if ( $remove_all_filters && strpos( $class, 'wpforms' ) === false ) {
unset( $wp_filter[ $notice_type ]->callbacks[ $priority ][ $name ] );
$cb = is_array( $arr['function'] ) ? $arr['function'][1] : $arr['function'];
// Remove a specific callback.
if ( ! $remove_all_filters ) {
if ( in_array( $cb, $rules[ $notice_type ], true ) ) {
unset( $wp_filter[ $notice_type ]->callbacks[ $priority ][ $name ] );
// Remove non-WPForms callbacks from `$common_deny_callbacks` denylist.
if ( in_array( $cb, $common_deny_callbacks, true ) ) {
unset( $wp_filter[ $notice_type ]->callbacks[ $priority ][ $name ] );
add_action( 'admin_print_scripts', 'wpforms_admin_hide_unrelated_notices' );
* Upgrade a link used within the various admin pages.
* Previously was only included as a method in wpforms-lite.php, but made
* available globally in 1.3.9.
* @param string $medium URL parameter: utm_medium.
* @param string $content URL parameter: utm_content.
function wpforms_admin_upgrade_link( $medium = 'link', $content = '' ) {
$url = 'https://wpforms.com/lite-upgrade/';
if ( wpforms()->is_pro() ) {
$license_key = wpforms_get_license_key();
sanitize_text_field( $license_key ),
'https://wpforms.com/pricing/'
// phpcs:ignore WPForms.Comments.PHPDocHooks.RequiredHookDocumentation
$upgrade = wpforms_utm_link( $url, apply_filters( 'wpforms_upgrade_link_medium', $medium ), $content );
* @param string $upgrade Upgrade links.
return apply_filters( 'wpforms_upgrade_link', $upgrade );
* Check the current PHP version and display a notice if on unsupported PHP.
* @since 1.5.0 Raising this awareness of old PHP version message from 5.2 to 5.3.
* @since 1.7.9 Raising this awareness of old PHP version message to 7.1.
* @since 1.8.4 Raising this awareness of old PHP version message to 7.3.
* @noinspection HtmlUnknownTarget
function wpforms_check_php_version() {
// Display for PHP below 7.4.
if ( PHP_VERSION_ID >= 70400 ) {
// Display for admins only.
if ( ! is_super_admin() ) {
// Display on Dashboard page only.
if ( isset( $GLOBALS['pagenow'] ) && $GLOBALS['pagenow'] !== 'index.php' ) {
// Display the notice, finally.
wp_kses( /* translators: %1$s - WPForms plugin name; %2$s - WPForms.com URL to a related doc. */
__( 'Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. <a href="%2$s" target="_blank" rel="noopener noreferrer">Read more</a> for additional information.', 'wpforms-lite' ),
'<strong>WPForms</strong>',
'https://wpforms.com/docs/supported-php-version/'
__( '<strong>Please Note:</strong> Support for PHP 7.3 and below will be discontinued soon. After this, if no further action is taken, WPForms functionality will be disabled.', 'wpforms-lite' ),
add_action( 'admin_init', 'wpforms_check_php_version' );
* Get an upgrade modal text.
* @param string $type Either "pro" or "elite". Default is "pro".
* @noinspection HtmlUnknownTarget
function wpforms_get_upgrade_modal_text( $type = 'pro' ) {
$level = 'WPForms Elite';
if ( wpforms()->is_pro() ) {
wp_kses( /* translators: %s - WPForms.com contact page URL. */
__( 'Thank you for considering upgrading. If you have any questions, please <a href="%s" target="_blank" rel="noopener noreferrer">let us know</a>.', 'wpforms-lite' ),
'https://wpforms.com/contact/',
'Upgrade Follow Up Modal',
__( 'After upgrading, your license key will remain the same.<br>You may need to do a quick refresh to unlock your new addons. In your WordPress admin, go to <strong>WPForms » Settings</strong>. If you don\'t see your updated plan, click <em>refresh</em>.', 'wpforms-lite' ),
wp_kses( /* translators: %s - WPForms.com upgrade from Lite to paid docs page URL. */
__( 'Check out <a href="%s" target="_blank" rel="noopener noreferrer">our documentation</a> for step-by-step instructions.', 'wpforms-lite' ),
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/upgrade-wpforms-license/', 'Upgrade License Doc', 'Upgrade Now' ) )
wp_kses( /* translators: %s - WPForms.com contact page URL. */
__( 'If you have any questions or issues just <a href="%s" target="_blank" rel="noopener noreferrer">let us know</a>.', 'wpforms-lite' ),
'https://wpforms.com/contact/',
'Upgrade Intention Alert',
'Upgrade Intention Alert'
wp_kses( /* translators: %s - license level, WPForms Pro or WPForms Elite. */
__( 'After purchasing a license, just <strong>enter your license key on the WPForms Settings page</strong>. This will let your site automatically upgrade to %s! (Don\'t worry, all your forms and settings will be preserved.)', 'wpforms-lite' ),
wp_kses( /* translators: %s - WPForms.com upgrade from Lite to paid docs page URL. */
__( 'Check out <a href="%s" target="_blank" rel="noopener noreferrer">our documentation</a> for step-by-step instructions.', 'wpforms-lite' ),
'https://wpforms.com/docs/upgrade-wpforms-lite-paid-license/',
'Upgrade Intention Alert',
* Hide the wp-admin area "Version x.x" in footer on WPForms pages.
* @param string $text Default "Version x.x" or "Get Version x.x" text.
function wpforms_admin_hide_wp_version( $text ) {
// Reset text if we're not on a WPForms screen or page.
if ( wpforms_is_admin_page() ) {
return 'WPForms ' . WPFORMS_VERSION;
add_filter( 'update_footer', 'wpforms_admin_hide_wp_version', PHP_INT_MAX );