Skip to content

Commit

Permalink
⚡ Fixed permalink issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeeptrivedi13 committed Jan 6, 2025
1 parent c1f990e commit 19c666c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions edwiser-bridge/admin/assets/css/eb-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
text-decoration: underline;
}

.run-diagnostics-start {
margin-top: 40px;
}

.run-diagnostics-start li {
margin-bottom: 15px;
}
Expand Down
12 changes: 8 additions & 4 deletions edwiser-bridge/admin/class-eb-settings-ajax-initiater.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,21 @@ public function check_permalink_setting_valid() {
}

if (function_exists('rest_url')) {
$response = wp_safe_remote_get(rest_url());
if (is_wp_error($response)) {
$response = wp_safe_remote_get(rest_url(),array(
'timeout' => '480',
));
$response_code = wp_remote_retrieve_response_code( $response );
if (in_array($response_code, array(200, 301, 302))) {
if ( get_option('permalink_structure') != '/%postname%/' ) {
return wp_send_json_success( array( 'correct' => false ) );
}
} else {
return wp_send_json_success( array( 'correct' => true ) );
return wp_send_json_success( array( 'correct' => false ) );
}
} else {
return wp_send_json_success( array( 'correct' => false ) );
}
return wp_send_json_success( array( 'correct' => true ) );
}
public function fix_permalink_setting_valid() {
// verifying generated nonce we created earlier.
Expand Down Expand Up @@ -318,7 +322,7 @@ public function check_get_endpoint_registered() {

// Check HTTP status code
$status_code = wp_remote_retrieve_response_code($response);
if ($status_code === 200) {
if (in_array($status_code, array(200, 301, 302))) {
return wp_send_json_success( array( 'correct' => true ) );
} else {
return wp_send_json_success( array( 'correct' => false ) );
Expand Down

0 comments on commit 19c666c

Please sign in to comment.