| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 7 | public static function get_current_url() { |
|
| 15 | 7 | global $wp; |
|
| 16 | 7 | $query_vars = array(); |
|
| 17 | 7 | $permalink_structure = get_option( 'permalink_structure' ); |
|
| 18 | |||
| 19 | // preserve all query vars that are in the GET as well |
||
| 20 | // if the default permalink structure is used, all query vars should be added |
||
| 21 | 7 | foreach ( $wp->query_vars as $qv_key => $qv_value ) { |
|
| 22 | 4 | if ( isset( $_GET[ $qv_key ] ) || ! $permalink_structure ) { |
|
| 23 | 4 | $query_vars[ $qv_key ] = $qv_value; |
|
| 24 | 4 | } |
|
| 25 | 7 | } |
|
| 26 | |||
| 27 | 7 | return add_query_arg( $query_vars, home_url( '/' . $wp->request ) ); |
|
| 28 | } |
||
| 29 | |||
| 30 | } |