Create a custom calculator in wordpress

Assuming you only want to display the results, not save them to the server, creating a live calculator would require a little bit of Javascript code, and creating form fields for the input. Note that by default, you cannot add Javascript to WordPress.com sites, or a self-hosted install with kses activated. You are not subject … Read more

Passing form data on submit

First check that it’s not empty, then typecast to a string value as a security precaution, because it’s always possible for this to be submitted as an array; e.g., by an attacker. Then unslash, sanitize, and continue by checking length and anything else that you’d like to validate. if ( ! empty( $_POST[‘contact_msg’] ) ){ … Read more

Multiple Taxonomy post query with exclusion

If I understood you correctly, an array of terms either slug or term_id, for example, depending on field to be exact. $args = array( ‘post_type’ => ‘a_post_type’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘tax_one’, ‘field’ => ‘slug’, ‘terms’ => array( ‘action’, ‘comedy’ ), ), array( ‘taxonomy’ => ‘tax_two’, ‘field’ => ‘term_id’, ‘terms’ … Read more

Unable to submit form using admin post wordpress

Caching is a tricky thing to achieve. You don’t want the users to see it and make them do extra work. This is way browsers try to cache as much as a reasonable thing they need to do. 301 Redirects This type of redirect is cached by browsers. 301 Moved Permanently. A 301 redirect is … Read more

Sending email via function in page or setting up the action properly in another page

<form action=”_contactform.php” method=”post” name=”submitform”> Note the action is _contactform.php, a relative URL, not an absolute URL, therefore it will get appended on to the current page. However, it would be more reliable to submit the form to the same page and leave the action blank, then run the code in WordPress. This way, at the … Read more