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

AJAX login without a plugin does not work. when add a action to function.php

You need to hook it later.

add_action('template_redirect' , 'prevent_profile_access');

References:

https://codex.wordpress.org/Plugin_API/Action_Reference
https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect

Related Posts:

  1. How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
  2. Autogenerate wordpress shortcodes using array?
  3. Shortcode display outside the div
  4. Execute a function using ajax
  5. How to remove action from plugin?
  6. What’s the point of using WordPress’s built in admin-ajax.php?
  7. wordpress custom login successful redirect hook
  8. jQuery Plugin to use WordPress functions in AJAX request
  9. ajax front-end increment views on click
  10. WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
  11. Shortcode button dosent work for all posts. Work for first post only
  12. AJAX button run function
  13. How to stop or remove an action being called inside a function of an extended class
  14. wordpress plugin is not activating from widget
  15. Calling plugin function inside custom plugin for onclick event
  16. Ajax : Call undefined function plugin_function() … can’t call any plugin function
  17. What is @Action in WordPress?
  18. Submit Form data to another page via Ajax (WordPress Way)
  19. Create a post builder skin in a plugin
  20. Plugin Development – Functions or Hooks?
  21. PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
  22. Are there action hooks for comments?
  23. How to get specific string/value from an array? php [closed]
  24. Where Should i write the code for wordpress ajax voting?
  25. How to remove a class function from a plugin by using remove_action()?
  26. Add action to custom Function
  27. wp_ajax action responds with 0
  28. grab or load text on demand
  29. Cannot pass value variable to WP AJAX functions
  30. The function called on the wp head hook becomes null
  31. Sharing varible between two add_actions
  32. Discern a specific plugin’s action hooks
  33. How to Unhook actions/filters in within Class in plugin
  34. WPML – Hook when language is switched (change user language)
  35. Use action, filter, or hook to append HTML to WordPress plugin function
  36. Ajax call to php function doesn’t work PHP code
  37. Update User Meta Via Ajax
  38. Compare Ajax Data Results
  39. Frontend AJAX Request causes Error: ‘Call to undefined function add_action’
  40. Why is WP template_include overwritting all templates rather than specified page?
  41. My ajax request don´t work and return 0
  42. WordPress environment not loading properly
  43. wp_login_form() ignoring login_form action hook
  44. how to repeat taxonomy in different places on wordpress
  45. Trouble Removing Plugin [closed]
  46. add query string to all pages after user logged in
  47. Call a function with href
  48. Simple ajax request with Vanilla JS keeps given 400 Bad Request
  49. How to not allow users to create new tags, but allow to them to use existing ones
  50. Remove Google Fonts Which Are (Probably) Added By Plugins
  51. Editor access to plugin settings
  52. How to pass JavaScript variable to PHP in wordpress widget?
  53. Custom Widget outputs the input but doesn’t save anything inside the textarea
  54. Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
  55. $wpdb working with ajax but showing ajax error instead of success
  56. Where to place custom functions?
  57. Why do plugins that cause ‘unexpected output’ create AJAX problems?
  58. “Request has expired” with “Make your site social” (Gigya) plugin
  59. creating html reusable blocks via shortcodes
  60. Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
  61. Disqus deleted comments are syncing with wordpress but active comments do not
  62. Difference and examples of esc_attr__() and esc_attr_e()
  63. add_action in a custom plugin
  64. Add action to fire when a published post is updated
  65. AJAX fileupload – TypeError: not a function ajaxSubmit()
  66. Proper way to use plugin functions in functions.php
  67. Why AJAX response 0!
  68. Custom CSS not being added by plugin
  69. auto activate plugin when theme is active
  70. Checkbox show / hide output result
  71. How to keep plugin (media-sync) running even the tab is closed?
  72. Load CSS before Theme CSS
  73. Custom Logo Link WordPress
  74. Where do I put the code snippets I found here or somewhere else on the web?
  75. How to convert Currency from USD to other IP Based currency in Php function
  76. How do I reinit WordPress plugins dynamically using jS?
  77. Attempting to list all product categories and the price range of all products within them
  78. function post to trash problem
  79. Get post content inside plugin class method
  80. Ajax Load More on Hierarchical Categories
  81. Creating new option (add_option) from AJAX – Settings API
  82. How to limit each front-end user to view just his own uploaded files on Amazon S3?
  83. Cannot access variables within a widget
  84. Redirect default login page to a custom page [duplicate]
  85. ajax request not returning the result
  86. How do I convince this button to do something when it is clicked?
  87. WordPress plugin options need to delete after deactivate & uninstall
  88. add_media_page function not creating submenu
  89. Filter for modifying image on upload
  90. First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
  91. Doing action based on input from options menu
  92. Ajax button “Load more” is not loading correct language version posts for logged out users
  93. How to Allow Users to Select Recipients In a WordPress Comment section?
  94. How often should I execute add_filter and function declaration in Code Snippets?
  95. Product customizing quiz – quiz adding products to the cart
  96. How to change all the urls of the WordPress site?
  97. Event Made Easy – Block registration to two or more events that have the same category
  98. I want to allow certain file types on dokan upload files
  99. Lost Password of my site, how to reset wordpress password?
  100. Re-use date format on different template
Categories plugins Tags actions, ajax, functions, login, plugins
wordpress theme link url
Anchor doesn’t work if it’s given in the url

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