php - admin-ajax GET response bad request

admin2025-06-05  1

I don't like to use wordpress, but I'm working on a business client website that want to use it but without the default wp- prefix for files and folders.To find a solution and to try satisfate this request, I've developed a script that will bulk rename patch and remove all the prefixes from wordpress files. I'm debugging the script and all works fine, the CMS installation will work fine and I can login and use all the core functions without any issue. I need to solve just one problem that I think it's related to the core files, in fact, the admin bar and the dashboard menù isn't loading properly, the icons are not loaded and the menù appears to be unstyled. Using the console I can see that there is a problem with an ajax GET request and I'm not able to find a way to fix the issue. the ajax request is made to this address: GET http://localhost:1507/wtest/admin/admin-ajax.php?action=wp-compression-test&test=1&_ajax_nonce=321784a9f8&1543592009302 400 (Bad Request)
that I know is a wordpress core file. I didn't modified it, but the response is always the error 400 bad request. Is there a way to fix this?

I don't like to use wordpress, but I'm working on a business client website that want to use it but without the default wp- prefix for files and folders.To find a solution and to try satisfate this request, I've developed a script that will bulk rename patch and remove all the prefixes from wordpress files. I'm debugging the script and all works fine, the CMS installation will work fine and I can login and use all the core functions without any issue. I need to solve just one problem that I think it's related to the core files, in fact, the admin bar and the dashboard menù isn't loading properly, the icons are not loaded and the menù appears to be unstyled. Using the console I can see that there is a problem with an ajax GET request and I'm not able to find a way to fix the issue. the ajax request is made to this address: GET http://localhost:1507/wtest/admin/admin-ajax.php?action=wp-compression-test&test=1&_ajax_nonce=321784a9f8&1543592009302 400 (Bad Request)
that I know is a wordpress core file. I didn't modified it, but the response is always the error 400 bad request. Is there a way to fix this?

Share Improve this question asked Nov 30, 2018 at 16:01 user9741470user9741470 1115 bronze badges 2
  • You shouldn't modify the core Wordpress files. Anything you do to them will break upon the first upgrade. – JakeParis Commented Nov 30, 2018 at 16:11
  • @JakeParis It's a client request, I've noticed that this argument of modifying wordpress cores seems to scare any developer who use this cms and this make me smile because an experienced developer doesn't care about this limitations. In my case, I need only to fix this small issue to make the dashboard menu styled. – user9741470 Commented Nov 30, 2018 at 16:16
Add a comment  | 

2 Answers 2

Reset to default 1

Instead of jumping through backward hoops and editing the WordPress core (You should never do this!) Just install the Hide My WP plugin.

I've solved the problem without using a plugin, (in fact my script run before the wordpress is installed) after some hours of debug, I've found where is the problem. I was removing the wp- prefix from all files,that It's useful for only one action inside the admin-ajax.php file that is wp-compression-test action, that is made using a GET request. My script was modifying the name and the error was because the passed action was only compression-test instead of wp-compression-test. I've made a patch for this, and I was able to get the wordpress installation working without any problem.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749134074a316651.html

最新回复(0)