Check nonce in the new bulk_edit_posts action

In order for the nonce verification to work, I needed to replace this: wp_verify_nonce( wp_unslash( $shared_post_data[‘lot_edit_nonce’] ), plugin_basename( __FILE__ ) ) with this: wp_verify_nonce( wp_unslash( $shared_post_data[‘_wpnonce’] ), ‘bulk-posts’ )

Logout button in menu without “wp” in links

You can use wp_logout_url() function for logout link. It will automatically add nonce to the url. Try this code: add_action(‘template_redirect’, function() { if (empty($_SERVER[‘REQUEST_URI’])) return; $uri = $_SERVER[‘REQUEST_URI’]; if (preg_match(‘#^/log-out/?$#’, $uri, $matches) === 1) { $logout_url = str_replace(‘&’, ‘&’, wp_logout_url()); wp_safe_redirect($logout_url); die; } }); If you do not want to use wp_logout_url(), then try to … Read more

Nonce check causing issues when creating new post

I know that this is not the only tutorial that has code that check nonce for meta boxes but this is truly idiotic. Nonce should be checked per the whole action not per parts of it and if your save_post hook was called it means that the save nonce was already checked and found valid, … Read more

How to insert wp_nonce field within echoed string

You use wp_nonce_field with the fourth parameter set to false. This way you can get the nonce field instead of echoing it: $end_data .= wp_nonce_field( “name-of-action”, “name-for-the-form-field”, true, false ); $end_data .= ‘<input type=”text” class=”ss_title_form_ajax_’ . $this->id . ‘” limit=”133″ value=”‘ . $this->native_title . ‘” size = “60” placeholder=””/>’; $end_data .= ‘<span class=”ss_title_form_ajax_’ . $this->id … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)