WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#47199 closed defect (bug) (invalid)

Cant post or edit comments from admin page when removing css/js query string

Reported by: Stolle7 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.2
Component: Script Loader Keywords:
Focuses: Cc:

Description

After updating to version 5.2 I was unable to either post or edit comments from the admin page. I disabled all plugins without any help, and then started doing trial-and-error by deleting parts of my functions.php (customized) one by one.

I isolated the problem to the following, quite commonly used php snippet to remove css and js versions from the files. When having this enabled, it's not possible to either post or edit comments.

Code:

<?php
function remove_cssjs_ver( $src ) {
  if( strpos( $src, '?ver=' )){
    $src = remove_query_arg( 'ver', $src );
                 }
    return $src;
  }

add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );

Information about my site:

  • WordPress version 5.2
  • Php 7.1
  • Theme: Child theme of "Accesspress Lite"

Change History (2)

#1 @Stolle7
11 months ago

  • Resolution set to invalid
  • Status changed from new to closed

I didn't check whether it was a theme issue and correctly it seems to be. I tried applying the same code to another site using another theme, and here the comment post worked. Afterwards I changed my theme to Twenty Nineteen, applied the same code and it still worked. I will direct my effort to the authors of my theme instead.

#2 @swissspidy
11 months ago

  • Component changed from Comments to Script Loader
  • Milestone Awaiting Review deleted
  • Severity changed from major to normal
Note: See TracTickets for help on using tickets.