rawurlencode( $permalink ), 'utm_campaign' => $campaign, 'utm_source' => $source, 'utm_medium' => 'wp-parsely', ); if ( '' === $campaign ) { unset( $query_args['utm_campaign'] ); } if ( '' === $source ) { unset( $query_args['utm_source'] ); } if ( ! isset( $query_args['utm_campaign'] ) && ! isset( $query_args['utm_source'] ) ) { unset( $query_args['utm_medium'] ); } return add_query_arg( $query_args, Parsely::get_dash_url( $site_id ) ); } /** * Determines whether Parse.ly dashboard link should be shown or not. * * @since 2.6.0 * @since 3.1.0 Moved to class-dashboard-link.php. Renamed from `cannot_show_parsely_link`. * * @param WP_Post $post Which post object or ID to check. * @param Parsely $parsely Parsely object. * @return bool True if the link can be shown, false otherwise. */ public static function can_show_link( WP_Post $post, Parsely $parsely ): bool { return Parsely::post_has_trackable_status( $post ) && is_post_type_viewable( $post->post_type ) && ! $parsely->site_id_is_missing(); } }