Hide menu items from not logged in users

You could use something like this: // Function to hide menu items for non-logged-in users function hide_menu_items_for_non_logged_in($items, $args) { // Check if user is not logged in if (!is_user_logged_in()) { // Define menu items to hide // (replace ‘menu-item-1’, ‘menu-item-2’, etc. with actual menu item IDs) $items_to_hide = array(‘menu-item-1’, ‘menu-item-2’); // Loop through menu items … Read more

Where to add wp_redirect on frontend pages?

I found that currently this is the only reliable solution: if (is_admin()){ header(‘Location: ‘. get_permalink()); exit(); } else add_action(‘template_redirect’, function (){ wp_redirect(get_permalink()); exit(); }); In the case of backend pages the template_redirect does not seem to be supported. If I use wp_redirect the redirection does not happen (maybe it is a bug) or the function … Read more

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