File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed
Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -135,10 +135,14 @@ private function _gen_ccss_file_tag( $request_url ) {
135135 */
136136 private function _ccss () {
137137 global $ wp ;
138- $ request_url = get_permalink ();
139- // Backup, in case get_permalink() fails.
140- if ( ! $ request_url ) {
141- $ request_url = home_url ( $ wp ->request );
138+
139+ // get current request url
140+ $ permalink_structure = get_option ( 'permalink_structure ' );
141+ if ( ! empty ( $ permalink_structure ) ) {
142+ $ request_url = trailingslashit ( home_url ( $ wp ->request ) );
143+ } else {
144+ $ qs_add = $ wp ->query_string ? '? ' . (string ) $ wp ->query_string : '' ;
145+ $ request_url = home_url ( $ wp ->request ) . $ qs_add ;
142146 }
143147
144148 $ filepath_prefix = $ this ->_build_filepath_prefix ( 'ccss ' );
Original file line number Diff line number Diff line change @@ -274,10 +274,14 @@ private function _finalize( $content ) {
274274 */
275275 private function _optimize () {
276276 global $ wp ;
277- $ this ->_request_url = get_permalink ();
278- // Backup, in case get_permalink() fails.
279- if (!$ this ->_request_url ) {
280- $ this ->_request_url = home_url ($ wp ->request );
277+
278+ // get current request url
279+ $ permalink_structure = get_option ( 'permalink_structure ' );
280+ if ( ! empty ( $ permalink_structure ) ) {
281+ $ this ->_request_url = trailingslashit ( home_url ( $ wp ->request ) );
282+ } else {
283+ $ qs_add = $ wp ->query_string ? '? ' . (string ) $ wp ->query_string : '' ;
284+ $ this ->_request_url = home_url ( $ wp ->request ) . $ qs_add ;
281285 }
282286
283287 $ this ->cfg_css_min = defined ('LITESPEED_GUEST_OPTM ' ) || $ this ->conf (self ::O_OPTM_CSS_MIN );
Original file line number Diff line number Diff line change @@ -331,7 +331,11 @@ public static function purge_ucss( $post_id_or_url ) {
331331 $ post_id_or_url = get_permalink ( (int ) $ post_id_or_url );
332332 }
333333
334- $ post_id_or_url = untrailingslashit ( (string ) $ post_id_or_url );
334+ $ post_id_or_url = (string ) $ post_id_or_url ;
335+ $ permalink_structure = get_option ( 'permalink_structure ' );
336+ if ( ! empty ( $ permalink_structure ) ) {
337+ $ post_id_or_url = trailingslashit ( (string ) $ post_id_or_url );
338+ }
335339
336340 $ existing_url_files = Data::cls ()->mark_as_expired ( $ post_id_or_url , true );
337341 if ( $ existing_url_files ) {
You can’t perform that action at this time.
0 commit comments