Securing a plugin pop-up window

Add some AJAX actions in your plugin file, something like this… The first one (without _nopriv) will already only be executed for logged in users, and the second will only be executed for logged out users, so there is no need to retest is_user_logged_in() here: add_action(‘wp_ajax_show_popup_contents’, ‘show_popup_contents’); function show_popup_contents() { $filepath = dirname(__FILE__).’/popup.php’; include($filepath); exit; … Read more

How to exclude a part of a page in search results

Copy below code and paste in function.php file to exclude pages from search results. if (!is_admin()) { function wpb_search_filter($query) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); } return $query; } add_filter(‘pre_get_posts’,’wpb_search_filter’); }