If you ‘have’ to do it this way, you should add the following line to the top of your above your include functions line:
require('/path/to/yourdomain.com/httpdocs/wp-blog-header.php');
global $wpdb; // In case you need DB calls also
@milo is correct though and you should think of a better way of doing this…
Alternatively, you could look at Gravity Forms or Contact Form 7 plugins which both have in built validation and allow customisation.
Related Posts:
- How can I get $id variable in widget’s form function?
- Refresh page after form action
- contactform7 remove tags with “wpcf7_autop false” from functions.php
- Add new user : make the fields First Name and Last name required
- How to call WordPress functions from a form processing script
- what is the meaning of settings_fields()
- update_post_meta for custom field not working upon form submission
- WordPress registration and contact form 7 [closed]
- Twenty Eleven Child theme error when attempting to use a rewritten function
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- Ninja form Redirect depending on text field content [closed]
- WordPress upload_mimes not working for front-end uploads of 3D files
- Ajax not working properly
- Fatal error: Cannot redeclare when switching themes
- Having a Function Inside of the Loop
- Removing custom meta data
- Is There Any Built In WP Functionality For Combining Form Fields To Return Specific Data
- wp_nonce_field is breaking form for reasons unknown
- Allowed memory size of 33554432 bytes exhausted (tried to allocate 9967617 bytes) in …\wp-includes\functions.php
- Contact Form 7 If Condition
- How to properly refresh page after form action?
- Init action and refresh page after form action
- Specify multiple categories for custom post template – FATAL ERROR
- dynamic enquiry form [closed]
- This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
- Problems adding a new field to product in cart
- Its my first time trying to create a website , I got an error Please help
- Postback redirect through add_action is not triggered
- Warning and fatal error
- Button click counter for login user
- How to change form action of wp-login page with a function
- WordPress Ajaxifying not working properly
- Fatal error: Call to undefined function. Underscore me
- How to debug function file causing white screen
- Sending Messages Back to the Template After Processing?
- us states dropdown function and echo in theme template files
- Adding custom field in menu options [duplicate]
- update_usermeta don’t work
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Fatal error after changes to functions.php, even with original file
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- Why functions metaboxes is causing White Screen in Admin [closed]
- Help finishing script to export WP user data when form submitted
- WordPress Custom wp mail template return full template
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Can’t find function which is called in a wordpress theme
- CF7 Remove Comma from ‘select’ ‘radio’ and ‘checkbox’ outouts
- Remove Actions/Filters added via Anonymous Functions
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- Use ‘add_theme_support’ instead of ‘add_custom_image_header’ In WordPress 3.4
- Generating Responsive Background Image Sizes in PHP
- Replacing select2 in admin backend for all selects
- Override a class function to include a custom template
- How to auto-update child posts whenever the parent post is updated?
- I created a child theme and it doesn’t work for some of the css files
- the_post_thumbnail fallback using hooks
- How to detect first visit of a user?
- Override woocommerce wc-class function
- How to hide, and not to remove the attributes metabox?
- how to edit functions.php in a child theme
- Only display link to author social media when it exists [closed]
- Get current page_id before loop, in functions.php
- Using $themename Variables
- Wp_schedule_event functions.php
- How to auto refresh when user change postcode
- Add sequential number to a Gravityforms form
- Can’t generate thumbnail images
- How to display retweet count and likes in the meta above the excerpt
- Possible to hook into Media Library preview File column and use a custom image?
- How to remove a specific word at the beginning of the content and add it to the end of the content
- Programmatically add Yoast meta description after post save
- Woocommerce checkout field
- Remove attachment page for audio media type only
- Where to store credentials used in a function? [duplicate]
- “options.php” not found
- Both the require and add_template_part function are not including the file
- Function that prevents users from uploading photos more photos
- Conditional function for excluding first image from content, not working
- Disable autosave with `function.php` for custom post wordpress?
- Different image using srcset function
- Save Meta when custom Taxonomy Saves
- Pagination not working – FrontPage
- Enable accessibility mode in widget as default
- What is the earliest Hook a Script can use?
- Submitting form to PHP
- Adding new Category does not refresh the backoffice
- How do I make a custom “Read More Blogs” button for my blog page
- True parameter but jquery register in header and not in the footer with wp_register_script
- Why is style.css not loading through the functions.php
- previous_post_link inside of a function?
- Instead of using $post, how do i get the thumbnail image of the $post
- Preventing PHP Execution in Parent Theme
- wp_upload_bits – define (sub)folder / (sub)directory before filename?
- How to shorten code with function?
- does acf_save_post cause endless loop?
- How to save custom made object in an array in a post meta field
- Get term count on a category page
- syntax error, unexpected ‘$id’ (T_VARIABLE) – where is the issue though? [closed]
- Comment turned Invisible