I believe your if statement is incorrect it should be an AND (&&
) not OR
so try
if ( ! is_user_logged_in() && ! is_page( 'lost-password' ) ) {
EDIT
Try using $object = get_queried_object()
for checking the post slug
$object = get_queried_object();
if ( ! is_user_logged_in() && ( ! $object || 'my-account' !== $object->post_name ) ) {
// ...
EDIT 2 The page slug was wrong so updated in the second example
Related Posts:
- wp_enqueue_script was called incorrectly
- Masking logout URL
- How can I tell if I’m on a login page? [duplicate]
- Is it possible to use a forgot password url filter?
- redirect wp-login.php to another page
- Login using the password from protected pages
- How do I redirect upon login a specific user based on role?
- Logging in redirects to correct page but shows logged out content until forced refresh
- Remove default user registration, login and subscriber profiles
- is_user_logged_in not working to redirect only logged out users
- How to change login labels
- How can I get my Script to work on the Login page?
- Login Redirect if Logged in from Specific Page
- Unable to login using username
- When a user logs in, how can they view the website instead of the admin menu?
- WordPress PHP Conflicting User Sessions
- Get User Login Data (date, time… )
- Registration Hooks don’t appear to be working
- If user is logged-in display/hide something
- Secondary Menu and Logged In Users
- Prevent WordPress Automatic Logout
- error at login page in wordpress
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Logout Redirect and also WP-login.php Redirect
- loginout function customization
- Add Login and logout buttons to top menu bar
- Show errormessages on wrong username/password on custom loginform?
- WordPress login set cookie that survive browser exit (wp_signon function)
- This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
- Prevent wp_signon redirect on failed login for ajax login
- How to redirect Subscribers on login to specific page, when logging in from a Page
- How to replace ACTION url from original wordpress login form?
- Unable to login after registration
- Allow logged in user to view a Page, else send to login screen and then redirect back to Page
- Redirect after login to current URL
- Login functions
- WordPress permanently logging users out
- How to request login for user but not for bots
- is_user_logged_in() isn’t working
- update_user_option not working as expected
- “Headers already sent” while trying to add a CSS file to my login page?
- Solution to render Shortcodes in Admin Editor
- How to run a function every 5 minutes?
- Add custom template page programmatically
- Modify Admin Bar Link
- How to override admin-bar style
- Woocommerce add to simple product attribute programmatically [closed]
- WP 4.4. responsive loads normal image after loading the responsive image
- Get Category and Excerpt From wp_get_recent_posts
- Error after editing functions.php
- How do I properly register bootstrap JavaScript into WordPress functions.php?
- Function to Download External Images to My Site
- Manipulate Output of wp_list_something: select menu instead of li’s
- how to fix Warning: Use of undefined constant _ – assumed ‘_’ (this will throw an Error in a future version of PHP)
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Load JS Script only for custom post types
- How to overwrite / extent wordpress function is_email
- WordPress upload_mimes not working for front-end uploads of 3D files
- Add caption functionality to custom WordPress theme
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- Removing permalink from post thumb in twentyeleven
- Default Custom Field Value Automatically Update
- meta tags doesnt fetch data from permalinks
- How to know if user logged in
- Option Tree integration of Custom CSS
- Remove “Published On” inside wp-admin
- Can’t call Javascript function – scope?
- Deprecated function get_user_by_email($email)
- header_image() with CSS
- Shortcode parse error – wrong syntax
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- Getting commenter meta
- Run a jquery script on on a certain template page
- why is this function firing on all child menu items as well?
- Custom styles in Tiny MCE with an external CSS file
- I changed Functions.php and now I get “cannot decode raw data NSURLErrorDomain:-1015” (not blank)
- two search forms on the same page
- Getting out side of wp root folder from function.php using absolute path
- current_page_item is missing inside wp_nav_menu
- Change default upload images size for contributors
- Strange error from functions.php files (wp_register_script)
- file.php not loaded?
- How to setup a popup registeration page in wordpress with function.php
- How to add if statement on WordPress shortcode output
- Why does modifying the “read more” link remove the link class?
- Woocommerce product price change
- How to display different blocks for mobile and desktops
- Help wiht adding fullcalendar.io to a WordPress page
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to create a WordPress Customizer Button to Clear a Cache?
- Move product attributes after summary on single product page
- Javascript and Stylesheet in child page
- Custom Nested WordPress Comments with avatar
- Functions file mods and CPU
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- How to overwrite ‘read more” text for artmag theme
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- Setcookie not setting cookies anywhere except admin
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories