| @@ -24,9 +24,8 @@ | ||
| 24 | 24 | * string if the URL could not be generated. |
| 25 | 25 | * |
| 26 | 26 | * @since 2.6.0 |
| 27 | 27 | * @since 3.1.0 Moved to class-dashboard-link.php. Added source parameter. |
| 28 | - * @since 3.16.1 Made the $campaign and $source parameters optional. | |
| 29 | 28 | * |
| 30 | 29 | * @param WP_Post $post Which post object or ID to check. |
| 31 | 30 | * @param string $site_id Site ID or empty string. |
| 32 | 31 | * @param string $campaign Campaign name for the `utm_campaign` URL parameter. |
| @@ -32,9 +31,9 @@ | ||
| 32 | 31 | * @param string $campaign Campaign name for the `utm_campaign` URL parameter. |
| 33 | 32 | * @param string $source Source name for the `utm_source` URL parameter. |
| 34 | 33 | * @return string |
| 35 | 34 | */ |
| 36 | - public static function generate_url( WP_Post $post, string $site_id, string $campaign = '', string $source = '' ): string { | |
| 35 | + public static function generate_url( WP_Post $post, string $site_id, string $campaign, string $source ): string { | |
| 37 | 36 | /** |
| 38 | 37 | * Internal variable. |
| 39 | 38 | * |
| 40 | 39 | * @var string|false |
| @@ -49,20 +48,8 @@ | ||
| 49 | 48 | 'utm_campaign' => $campaign, |
| 50 | 49 | 'utm_source' => $source, |
| 51 | 50 | 'utm_medium' => 'wp-parsely', |
| 52 | 51 | ); |
| 53 | - | |
| 54 | - if ( '' === $campaign ) { | |
| 55 | - unset( $query_args['utm_campaign'] ); | |
| 56 | - } | |
| 57 | - | |
| 58 | - if ( '' === $source ) { | |
| 59 | - unset( $query_args['utm_source'] ); | |
| 60 | - } | |
| 61 | - | |
| 62 | - if ( ! isset( $query_args['utm_campaign'] ) && ! isset( $query_args['utm_source'] ) ) { | |
| 63 | - unset( $query_args['utm_medium'] ); | |
| 64 | - } | |
| 65 | 52 | |
| 66 | 53 | return add_query_arg( $query_args, Parsely::get_dash_url( $site_id ) ); |
| 67 | 54 | } |
| 68 | 55 | |