Hot answers tagged forms
4
jQuery is a js library not a transport protocol, your data is sent via GET or POST, wether you use jquery or not.
Think of it like this, sometimes it's the user in the first frame, sometimes it's javascript:
Firstly nonces are not the same as sanitisation, they have different purposes
Sanitisation is about verifying what the source says is in the ...
2
Assuming there is no contact form plugin which matches your needs, the proper way to do it in wordpress is to write and add an appropriate page template to your theme which contains and handles your form. Once done you associate the page in which the form should be displayed with the page template and then your action path is simply "".
2
Do not call your PHP files directly. This will break, because in some setups, the plugin directory might be located on another domain, and your file would operate without the WordPress context now.
Use the current URL as form action URL (or admin-post.php), then test if the request is a POST request and handle the form submission. Then redirect back to the ...
2
What would be the easiest, cheapest approach for this?
Simple, create one form per language.
In functions.php or, preferably, as a custom plugin:
add_shortcode( 'my-lingo-form', 'shortcode_wpse_98360');
function shortcode_wpse_98360()
{
$lingo = your_language_detection_method();
switch( $lingo )
{
case 'en':
echo ...
1
You are actually closer in your first attempt.
My recommendation would be to create a folder called "scripts" in the WP root and put your PHP script files in here as well as your attachment(s). You will then need to declare the full path in your action attribute as the script does not now share the same file path as in your "flat HTML file structure".
...
1
The problem is problably here:
<form id="oselector" method="GET" action="<?php the_permalink(); ?>">
Your code is not in the WordPress Loop. According to the Function Reference (emphasis added):
the_permalink() - Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is ...
1
When you load your process.php file directly, it's not within the context of the WordPress environment, so no WordPress functions are available. WordPress has a native AJAX API that should be used for this sort of thing.
First, enqueue your javascript file, then use wp_localize_script to pass the location of admin-ajax.php, which will be processing the ...
1
When you get those "headers already sent" messages, it is usually one of several things:
You are echoing something when you shouldn't be, which is any time before get_header on the front end. I can't remember exactly where the window is on the backend.
You are doing something that is triggering a warning or notice that is printing content too soon. Things ...
1
You can add a filter to the editor html
add_filter( 'the_editor', 'add_required_attribute_to_wp_editor', 10, 1 );
function add_required_attribute_to_wp_editor( $editor ) {
$editor = str_replace( '<textarea', '<textarea required="required"', $editor );
return $editor;
}
Only top voted, non community-wiki answers of a minimum length are eligible