Wp die causing 500 Internal Server Error?

I have function to upload images inside my settings API ,it uploads images as expected but the problem comes when user chooses to upload non-image file to stop users from uploading other files (non-image files) i am using wp_die(‘No image found’); an that leads to dreaded 500 Internal Server Error message displayed. Strange thing is … Read more

Verify Nonce returns false – Request Nonce returns correct value

I’m trying to verify that the nonce I created exists but for some reason it keeps returning false, why is this happening? Creating my nonce: <?php wp_nonce_field(‘test_slider_action’,’test_slider_options_nonce’); ?> Verifying my nonce exists: if($_POST && wp_verify_nonce($_REQUEST[‘test_slider_options_nonce’])) echo “TEST”; if I dump my $_REQUEST I get the correct value, but if I dump my wp_verify_nonce it returns … Read more

Featured Image not showing in admin

Currently im making new theme and had the idea of adding featured image in the admin side of wordpress, unfortunately its not working this is what i have tried I have added this code in functions.php add_theme_support( ‘post-thumbnails’); i also tried to change it add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); // Add it for posts … Read more

is_page() function doesnt working

I’m trying to add these custom CSS and JS (written inside a custom plugin) only add to a specific page. this is my code <?php function randomAlphaNumeric($length) { $pool = array_merge(range(0,9), range(‘a’, ‘z’),range(‘A’, ‘Z’)); $key=”; for($i=0; $i < $length; $i++) { $key .= $pool[mt_rand(0, count($pool) – 1)]; } return $key; } add_action(‘init’, ‘register_script’); function register_script(){ … Read more

stray elements

I coded a wordpress shortcode for columns that basically inserts html via a shortcode. Problem is that wpautop adds stray p elements that renders the code invalid. To test put this into your functions.php: function static_col_container($atts, $content) { extract(shortcode_atts(array( ‘foo’ => ‘bar’ ), $atts)); $content = do_shortcode($content); $container=”<div class=”static-column-container”>” . $content . ‘</div>’; return $container; … Read more

Plugin Development: WordPress processes twice on post update. How to skip process on the first?

When you create a plugin and set up a process function, WordPress will run the plugin process function twice upon clicking the update button. I believe the first process is for the versioning (revision) post, and the second the actual post. Now, I’ve got an INSERT function in my process, so it is now inserting … Read more