Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Redirection loop error after login from a custom post type post

How are you currently generating the login URL & handling the redirect?

You should simply be using wp_loginout and passing the permalink as the redirect, and let WordPress handle everything else:

<?php wp_loginout( get_permalink() ) ?>

Or for a more custom implementation:

<?php if ( ! is_user_logged_in() ) : ?>

    <a href="https://wordpress.stackexchange.com/questions/158728/<?php echo esc_url( wp_login_url( get_permalink() ) ) ?>">My custom log in text</a>

<?php endif ?>

If you still have issues, disable all plugins. It might also be worth posting the code you use to register the custom post type.

Related Posts:

  1. Strange behavior on WP_query
  2. Looping through custom taxonomy in one template
  3. get_post_meta for Custom Post Type ( CPT )
  4. WordPress loop, show only one post per custom field
  5. How to return custom posts in loop?
  6. All custom posts are not showing up
  7. WordPress query posts by custom post type not workng
  8. How to keep a CPT stick to specific position?
  9. How to show Y number of custom posts after every X normal posts?
  10. How To Loop Through list with Custom Post Types
  11. Custom post type with custom taxonomy permalinks
  12. custom post type loop
  13. How to Fix Custom WordPress Loop with Pagination on Single Post View?
  14. How to check if meta box value is false for all posts then do something based on that
  15. Tricky Custom post loop
  16. Loop posts in a table ordered by a custom field value
  17. Is it possible to add query parameters on the archive page?
  18. Custom Loop Event Page
  19. Custom taxonomy page template
  20. Multiple loops for custom post type to spread data across rows
  21. Cant insert wrapper div into index.php
  22. Pagination on custom post types
  23. Custom Post Type + Category archive
  24. Pagination in custom post type page template
  25. Loop with Custom Post Type and Taxonomies
  26. How to get past and upcoming post by defining date in custom field?
  27. display news with pictures 3 small and one large (loop)
  28. Loop multiple taxonomy in custom post
  29. $post breaking container loop
  30. How to query all custom posts of a certain type and checking what category they have
  31. Custom post type archive pagination with HTML5Blank theme?
  32. Post data in separate divs with incrementing class using WP_Query
  33. How to create content automatically when a post is published?
  34. WordPress Custom Post Type and sort by Tags
  35. WordPress loop for multiple custom post types
  36. Load different template for CPT (in loop) in my plugin?
  37. Custom Post Type Order Index Loop
  38. After rewriting post type’s URL, the number of queries has increased dramatically
  39. How to loop custom post type posts by author?
  40. Display posts from category in page
  41. How can I pull information from my loop and divide them seperately?
  42. Multiple Queries and Loops within CPT Archive
  43. Posts without featured image using other post’s featured image
  44. WordPress nested loop not working
  45. Order by custom field attribute
  46. Get result from Custom Field in Custom Post type
  47. Display Custom Taxonomy of custom post type
  48. Pagination not working with custom loop
  49. Fallback if statement based on the number filtered from it
  50. If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
  51. Turn post into simple slideshow
  52. Sorting custom post types by taxonomy (So close)
  53. Inserting random posts
  54. Nested loop called with shortcode duplicating the content above the main loop
  55. Create custom post order (with custom post type meta)
  56. Pagination not working with custom loop
  57. Pagination not working with custom loop
  58. Pagination not working with custom loop
  59. Looping taxonomy in taxonomy?
  60. next_posts_link returns same content of 1st page
  61. Custom Loop and Standard Blog Loop Issue
  62. Listing custom post type items from a couple of custom taxonomies
  63. Pagination not working with custom loop
  64. Custom loop won’t work, can’t find problem
  65. Custom post-type’s pagination not working in category.php
  66. Pulling in a particular post into a single page based on the post id passed into the code
  67. Noob Loop Question
  68. Categories and page filtering with pre_get_posts
  69. Display multiple custom post type lists on homepage – multiple loops
  70. Loop through multiple custom taxonomy terms and display posts for a custom post type
  71. Custom Post Type Loop breaking php
  72. Styling first post using Advanced Custom Fields
  73. loop through custom post-type with two meta_keys
  74. Custom Post Types and 404 Pages
  75. Query Custom Post Type by Tag
  76. Loops running into each other
  77. Display by tag from different post types
  78. Fourth page of custom post type archive page does not exist
  79. Loop to pull content from parent element in custom post type [duplicate]
  80. Loop doesn’t work in single-product.php page but works at normal page
  81. Catergory args causing loop not to show
  82. why get_post_meta is returning 0?
  83. How do I filter a custom post type loop by a field?
  84. Post_type doesn’t work for widgets?
  85. the_content() stop images being pulled through
  86. How do I correctly query posts from a post ID?
  87. Get Posts From A Certain Post Type In An ID Array
  88. display custom post type from register taxonomy
  89. How to exclude certain portfolios from a loop
  90. Custom post type and have_posts() return empty result
  91. Show search for data extracted from metabox
  92. why does my post loop break the page?
  93. Render a loop in Timber (twig for WordPress)
  94. How to create custom page templates with default page layout framework?
  95. show custom post’s post in two different divs [duplicate]
  96. display all posts in current category
  97. Limit wordpress posts loop to continue onto another page
  98. How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
  99. Get all active posts that are tied to a custom taxonomy for a custom post type
  100. Unable to display paging navigation with a custom post type loop
Categories custom-post-types Tags custom-post-types, loop, wp-login-form
Meta-Box to add multiple items one at a time and on publish save all
How to configure folders with ‘Child Theme’?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress