How do I change admin-ajax in WordPress?

All the ajax calls in the frontend are made by the default URL /wp-admin/admin-ajax.php. This URL is also used by hackers to upload viruses and scripts on your website.

Changing the wp-admin/admin-ajax.php URL is mandatory for protecting the WordPress site from hackers.

To easily change the admin-ajax.php path you can use Hide My WP Ghost plugin. After adding a new ajax URL, the default admin-ajax.php URL will be hidden from hackers.

How to change admin-ajax in WordPress

  1. To change the admin-ajax.php path, go to Hide My WP > Permalinks > Custom Ajax URL
  2. To hide the wp-admin path from ajax calls, switch on Hide My WP > Permalinks > Hide wp-admin from ajax URL 

Why you must have Hide My WP Ghost: https://hidemywpghost.com/hide-my-wp-why-you-must-have-it/