I solved my problem
add_filter('wpcf7_validate_text', 'or_input_validation_filter', 20, 2);
function or_input_validation_filter($result, $tag) {
if ('your-link' == $tag->name) {
$your_link = isset($_POST['your-link']) ? trim($_POST['your-link']) : '';
$your_file = (!empty($_FILES["file-image"]["name"])) ? trim($_FILES['file-image']['name']) : '';
if($your_link == '' && $your_file == '') {
$result->invalidate($tag, "One of the fields has not been completed?");
}
}
return $result;
}
Related Posts:
- How to check if a string is a valid URL
- What is the best practice for escaping data URIs?
- Shortcode putting html such as
- Get value of contact form 7 radio button [closed]
- How to find the output of contact form 7 shortcode? [closed]
- Contact Form 7 from adding paragraph and break tags to HTML emails [closed]
- Validate Uploaded Image using WordPress’ Built-in Functions?
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]
- How to display posts by current user in a drop down
- How to remove role=”navigation” from all nav elements?
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- What esc_ to use to validate this?
- Sanitizing text fields in array
- Download PDF after CF7 form submission
- Contact Form 7 – Replace database configured form template with a static file
- register_setting & add_settings_error validation issues with multiple fields
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
- Using CFDB7 vs Custom MySQL Database [closed]
- Pass get data from anchor URL [closed]
- WordPressUser Submission Form
- Contact form – problem with displaying message about sent mail
- Add custom HTML data to Contact Form 7 mail?
- How to use Contact Form 7 shortcode value in a page?
- Custom HTML form using PHP – help with ajax/username validation
- Contact Form 7: custom validation [closed]
- Send foreach $_post method to contact form 7 [closed]
- WP Debug enabled Undefined index error in a widget
- Custom Registration and Login Forms with reCaptcha 2 Validation
- Import and use a variable in additional settings of Contact Form 7 [closed]
- Saving User Input to PHP Variable
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- Contact form with dynamic dropdown and filter
- why is kses removing semicolon from inline style?
- How can I save a user’s Contact Form 7 inputs as separate columns in a custom WordPress table?
- oneOf JSON Schema validation not properly working for custom post meta value?
- Validate a custom form with js and php
- GET problem in WordPress
- WordPress gallery shortag
- Almost Done… Post Format Code
- wordpress admin plugin menu custom css
- Help with page nav?
- Show recent posts starting at a specific number archive
- Add title=”” to A PHP Code
- Get Page ID from Backend
- Help with WordPress function inside a shortcode
- Wpdb->insert() doesn’t insert new row after the last one
- WordPress plugin admin page – using WordPress function in linked php file
- HTML table attributes ignored
- What’s the best way to include PHP code in pages?
- Is there any wordpress plugin to upload images and captions to multiple pages once
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- PHP in Edit Post link
- Removing the first 8-10 letters from a post?
- How to add drag and drop functionalities to a div inside option panel
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Timthumb.php image gallery not working on Multisite WordPress
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- How do you create two separate Register pages?
- $_GET[‘updated’] does not work in WordPress 3.1?
- Why doesn’t PhotoSmash plugin play well with wp_query?
- How to send form data from WordPress (Meta Box) to an OData service?
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- Removing WordPress Footer -without access to PHP code?
- dynamic page using php from sql database
- Upload non-featured image to image field
- Usage of call back function of add_meta_box()
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress get_media_embedded
- Change product_base programmatically
- wp_delete_comment takes two tries to delete – then deletes all comments
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- Scheduling an event inside plugin class is not working
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to set a template with wp_insert_post
- WordPress Custom SQL Table with UserID Filter for results
- Automatically add images to a menu
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Get access to variable from previous pageview, excluding ajax-calls
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Permission callback to check if user has application password
- Load Posts on Click via Ajax into a DIV
- How to catch wordpress post ID when it’s published
- calling a custom field value inside functions.php
- What is the best way to define constant options for a theme?
- WordPress redirect redirecting too many times or not at all
- Can’t retrieve element with WordPress default @fetch_rss();
- set post limit at load more ajax wordpress
- I have a snippet to redirect all users to a maintenance page. How do I exclude users with admin role?
- php esc_html_e with an html link inside not working
- How to filter custom taxonomy term name, slug, and description?
- An audio player that showcase a random song from playlist every 24h [closed]
- how to prevent wordpress admin from logging in via woocommerce my-account page
- get_the_ID() in the footer returns wrong value
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Trouble inputting variable into WP query
- How to get the last category name of a child category?