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?
- A non well formed numeric value encountered
- Display all values of custom a field created with ACF on a page
- How do I directly access a PHP file located in my themes folder?
- wpdb::prepare was called incorrectly
- WordPress the_content() return only one image from a specific category
- count number of user comments with a specific comment meta value
- Display all posts in current category
- file_exists() acting weird
- Is it possible to use the featured image of a page as a css background without inlining?
- PHP syntax error when using wpdb update?
- Warning: array_pop() expects parameter 1 to be array, boolean given
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- items_wrap not working
- Using shipped version of jquery
- Can’t search posts using WP_QUERY inside AJAX Function
- How do I Add HTML to the_excerpt() & the_content() Output?
- User’s total comment count excluding comments on their own posts
- Is there a way to programmatically create multiple pages utilizing the same template but different content from a json file?
- Populate dropdown with Child Pages based on Parent Page chosen
- do search in two site and show the result in first site
- What’s the uses of wp_cache_set() or wp_cache_add()?
- How to get post’s current parent term ID?
- Use of wp_insert_post and parameters
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Revoke Access to certain user roles and admin pages
- Counting Search results, and displaying the offset per page
- Where is this function’s callback getting its arguments from?
- Using Argument from Function to Re-Direct Visitor (WordPress)
- How to present a div only when the index.php is accessed for/by the single post pages
- Displaying list of posts in category page
- WPDB – Read and write value from / to database
- Is it possible to add a custom page to a free WordPress site? [closed]
- search and add in wordpress content
- How to sort WooCommerce products page by latest in-stock items first?
- WP_Query for woocommerce products with a pattern as a post_title
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- Get WooCommerce products with similar SKU
- 404 on old link after changing post url
- Ajax filter with loadmore button
- How do I disable cache for a certain page?
- how to fix Warning: A non-numeric value encountered in this specefic line of code
- Responsive loop with 3 columns inside row then 2 columns
- Fetch commens from a specific post
- Set notification if is two product category in cart
- Cron job -many duplicate posts
- Reverse Cross-Sells (WooCommerce)
- Unexpected behavior when trying to manually install WordPress on macOS Sierra
- Allowing HTML elements in title widgets spacing problem
- Pull a div from one WordPress site into another WordPress site
- Can not manually create a database ( db, user, pass ) for a plugin
- Are widget arguments always set inside My_Widget::widget()?
- Rewrite url for custom post type not working
- Jquery and Sticky
- Different image and background color depending on page type
- How to style this wp_list_pages markup
- How To: Simple domPDF Example
- WordPress format json in postmeta table
- notify users when changed database
- Check user last login date
- 404 page is not the same when using PHP code in functions
- How can I modify the html output of a custom post type admin page?
- How do I change the color of a pop-up on the main page?