is_admin() returns true when using admin-ajax.php from front end script

WordPress sets is_admin() to true for all ajax requests (front-end or admin-side). (See codex). There’s isn’t away of over-riding this (and you shouldn’t anyway). If your ajax request can be fired from both front-end and admin side, then you may want to include whether it ‘is admin’ or not when you post the data. But … Read more

Front-End Post Submission

<?php $postTitle = $_POST[‘post_title’]; $post = $_POST[‘post’]; $submit = $_POST[‘submit’]; if(isset($submit)){ global $user_ID; $new_post = array( ‘post_title’ => $postTitle, ‘post_content’ => $post, ‘post_status’ => ‘publish’, ‘post_date’ => date(‘Y-m-d H:i:s’), ‘post_author’ => $user_ID, ‘post_type’ => ‘post’, ‘post_category’ => array(0) ); wp_insert_post($new_post); } ?> <!DOCTYPE HTML SYSTEM> <html> <head> <meta content=”text/html; charset=utf-8″ http-equiv=”Content-Type” /> <title>Untitled Document</title> </head> … Read more

Is it Possible to Extend WP Customize JS Methods?

I will enhance my small comment on your question. But again the hint; I’m not a JS expert. The follow source, hints was only used on playing with the Customizer for different checks, examples, like my sandbox. wp.customize Understanding the WP theme customizer interface centers around understanding the wp.customize javascript object. The wp.customize object is … Read more

How to set a custom post type to not show up on the front end

Another option would be to set a 301 redirect for all the slideshow CPTs to redirect somewhere (like the home page). This would get picked up by Google, and also make sure no one accidentally gets on them function rkv_slideshow_redirect() { global $wp_query; // redirect from ‘slideshow’ CPT to home page if ( is_post_type_archive(‘CPT_NAME_HERE’) || … Read more

How to use nonce with front end submission form?

Use the following code inside just before tag on your front end code. wp_nonce_field(‘name_of_your_action’, ‘name_of_your_nonce_field’); The above code will generate two hidden inputs inside your form tag. Now you can verify your nonce in the backend where you will process your form. Use the following code to verify the nonce you just created above. if(wp_verify_nonce($_REQUEST[‘name_of_your_nonce_field’], … Read more