Title: Unreachable Code After Exit Statement
Last modified: October 16, 2024

---

# Unreachable Code After Exit Statement

 *  [Patrick Rauland](https://wordpress.org/support/users/bftrick/)
 * (@bftrick)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/unreachable-code-after-exit-statement/)
 * I was looking through the code and noticed that there’s some unreachable code
   in your plugin.
 * There’s a redirect on line `6` & and exit statement on line `7`.
 * There are `17` lines of code after this that are unreachable.
 *     ```wp-block-code
       public function impact_activate( $plugin ) {	$arr = explode( '/', $plugin );	if ( count( $arr ) >= 1 && strpos( $arr[ count( $arr ) - 1 ], 'impact' ) !== false ) {		$store_url = home_url();		$path      = '/wp-admin/admin.php?page=impact-settings';		$url       = $store_url . $path;		wp_safe_redirect( $url );		exit;		global $user;		global $wpdb;		$store_url    = home_url();		$user         = wp_get_current_user();		$endpoint     = '/wc-auth/v1/authorize';		$params       = array(			'app_name'     => 'Impact',			'scope'        => 'read_write',			'user_id'      => $user->user_login,			'return_url'   => home_url() . '/wp-admin/admin.php?page=impact-settings',			'callback_url' => home_url() . '/wp-json/impact/v1/callback',		);		$query_string = http_build_query( $params );		$url          = $store_url . $endpoint . '?' . $query_string;		wp_safe_redirect( $url );		exit;	}}
       ```
   
 * I’d suggest deleting these lines to clean up the code base.

The topic ‘Unreachable Code After Exit Statement’ is closed to new replies.

 * ![](https://ps.w.org/impact-partnership-cloud/assets/icon-256x256.png?rev=2523631)
 * [Impact: Partnership Cloud](https://wordpress.org/plugins/impact-partnership-cloud/)
 * [Support Threads](https://wordpress.org/support/plugin/impact-partnership-cloud/)
 * [Active Topics](https://wordpress.org/support/plugin/impact-partnership-cloud/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/impact-partnership-cloud/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/impact-partnership-cloud/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [Patrick Rauland](https://wordpress.org/support/users/bftrick/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/unreachable-code-after-exit-statement/)
 * Status: not resolved