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?
- How to include checkbox in widget backend form?
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- renaming an admin menu item with decimal array index number
- How to add 2 posts under another post? Formatting should be intact
- Can’t Find a Way to Edit the Home Page Content [closed]
- Fatal error: Call to undefined function wpsc_cart_item_count()
- No wp-config.php file on local install of wordpress – site still displays
- Woocommerce Custom CSV export
- integrating external php library into wordpress- the right way
- To echo or not to echo?
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- How to limit the content coming from wordpress shortcodes?
- Asking popup for delete post in WordPress [closed]
- Change description on specific WooCommerce product status change
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- How to deal with checkboxes in edit page?
- Must I download entire WP directory for each separate instance/website that uses WP?
- search and replace preword from author
- Add meta noindex to post if it has a specific taxonomy
- Displaying Hierarchical custom taxonomy
- Open post-content in archive page in a Modal box with bootstrap
- Creating own shortcode – echoeing php variable based on JS variable
- How do I Turn This Into An if statement?
- Sort meta-value in the sequence array in pre_get_post
- How do I link a button I created in theme customizer to a function?
- Which is the correct way to conditionally enqueue a CSS file?
- how to remove colon and white space in a string by php
- Tell WP register script to load a script only when the entire page is loaded
- anyway to put inside a $outprint=sprintf()
- What does $_GET[‘iphone’] do?
- Add title=”” to A PHP Code
- What’s the best way to include PHP code in pages?
- Line breaks inside shortcode variable
- Undefined index for default custom theme option
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- woocommerce wc_create_order(); is creating multiple orders instead of one?
- Override Admin menu icon
- List of Events with Multiple Dates: Only NEXT Date
- Including Custom fields within the_content
- Functions.php and includes
- Add other class content with reference class value
- Programmatically add a product to the cart and set price to zero when buying from certain category
- I want to show cart items number if any or nothing, simple CART text
- Slug duplicates once clicking on link
- Find and print first entry from WordPress post in custom excerpt?
- Language does not switch while cache is enabled
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Limit content size by character or word in database
- Set user status to absent on WordPress
- Customizer: How to Sanitize a Decimal Number Range
- Switch position of elements in the footer [closed]
- Problem with ajax request and directory structure after site migration
- Access methods in plugin template
- WordPress HTML Helper
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- Notice: Undefined index: fix with isset [closed]
- List sibling pages widget, exclude current page
- Amending PHP for WordPress Theme
- get_permalink returning first letter
- Shortcode for Visual Composer Grid fails turning string to integer
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb