We have a strange and very frustrating problem involving the usage of a security nonce. An ajax call is made within my plugin to return some post results and a security nonce is generated and sent via the call. The nonce is then verified in the ajax callback function as per the code below. This works fine but the problem is that when the add_action(‘init’, ‘security_nonce’); line is included in the plugin we are then unable to select featured images in any of the posts as none of the images in the media library will display. When we comment out the line we are then able to upload and select featured images again. Furthermore, when we remove everything to do with nonces in our plugin it breaks some of the css includes on our site and we have no idea why. But we don’t want to remove the nonce anyway for security reasons so if anyone has any ideas as to why this might be breaking the featured image selection we would be delighted to know.
Thanks in advance.
and then to verify the nonce within the callback:
check_ajax_referer( 'you can never be too careful', 'securityCheck' );
- The topic ‘Security nonce causing inability to select featured image’ is closed to new replies.