In the standard structure of Wordpress, a warning page appears when the user makes spam or goes too fast. The link structure of the warning page is "/wp-comments-post.php". Briefly (see images) https://www.dropbox.com/s/b5icvg8cjzuc28q/wp-slow.png https://www.dropbox.com/s/4yt8gdyl7hr1b0w/wp-spam.png

I want to link this link structure to a special page like "error" to hide it. Or, I just want to make a little warning window inside the page. How can we do that Thank you in advance!

  • Sounds like a case for Ajax to me. – Nicolai Oct 15 '18 at 18:43
  • I guess, no. I went to the "wp-includes" folder. I've edited the "comment-template.php" file. ( I've edited the 2250 line ) code 'action' => site_url( '/error.php' ), code I pointed to "error.php". then I changed the name of "wp-comments-post.php" to "error.php" in the main directory. Here is the result! dropbox.com/s/84oy6u6067do6wp/error.php.png I have not received an error on the site right now. everything is fine as needed. I will continue to monitor the result so that it does not cause an error. @Nicolai – A. Muller Oct 15 '18 at 19:00
  • Don't edit core files, the changes will be overridden when you update WordPress. – Nicolai Oct 15 '18 at 19:05
  • Besides, it sounded like you want dynamic elements, hence the mentioning of Ajax, but maybe I misunderstood your intention. – Nicolai Oct 15 '18 at 19:06
  • Yeah. In fact, it makes more sense to change the link on the theme files. may not be a permanent solution. Thank you... (I'll try different ways) – A. Muller Oct 15 '18 at 19:11

You can change the URL for the action of the comment form like this:

add_filter( 'comment_form_defaults', 'wpse316762_comment_form_defaults' );
function wpse316762_comment_form_defaults( $defaults ) {
  $defaults[ 'action' ] = site_url( '/error.php' );
  return $defaults;
  • A kernel file change can be overridden in updates. (Even if it does not cause any errors) Theme / Funcstion.Php is the definitive way to introduce. I just remembered. I will add the code and check. (I will restore the original file) Thank you very much! – A. Muller Oct 15 '18 at 19:19
  • I have restored the original "comment-template.php" file. and I added the code to the theme. This definitely worked. Thanks again. – A. Muller Oct 15 '18 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.