| @@ -869,8 +869,34 @@ | ||
| 869 | 869 | <?php endif; ?> |
| 870 | 870 | </form> |
| 871 | 871 | </div> |
| 872 | 872 | |
| 873 | + | |
| 874 | + <!-- Auto-Redirect on Slug Change Setting --> | |
| 875 | + <?php | |
| 876 | + if (isset($_POST['metasync_save_auto_redirect']) && current_user_can('manage_options') && wp_verify_nonce($_POST['_metasync_auto_redirect_nonce'], 'metasync_auto_redirect_toggle')) { | |
| 877 | + $auto_redirect = isset($_POST['metasync_auto_redirect_enabled']) ? 1 : 0; | |
| 878 | + update_option('metasync_auto_redirect_enabled', $auto_redirect, true); | |
| 879 | + echo '<div class="notice notice-success is-dismissible"><p>Auto-redirect setting updated.</p></div>'; | |
| 880 | + } | |
| 881 | + $auto_redirect_current = get_option('metasync_auto_redirect_enabled', 1); | |
| 882 | + ?> | |
| 883 | + <div style="background: var(--dashboard-card-bg, #1a1f26); border: 1px solid var(--dashboard-border, #374151); border-radius: 8px; padding: 12px 16px; margin: 15px 0; display: flex; align-items: center; gap: 12px;"> | |
| 884 | + <form method="post" style="display: flex; align-items: center; gap: 12px; margin: 0;"> | |
| 885 | + <?php wp_nonce_field('metasync_auto_redirect_toggle', '_metasync_auto_redirect_nonce'); ?> | |
| 886 | + <label style="display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--dashboard-text-primary, #fff); font-weight: 500;"> | |
| 887 | + <input type="checkbox" name="metasync_auto_redirect_enabled" value="1" <?php checked($auto_redirect_current, 1); ?> onchange="this.form.submit();" style="width: 16px; height: 16px; margin: 0; flex-shrink: 0;"> | |
| 888 | + Auto-Redirect on Slug Change | |
| 889 | + </label> | |
| 890 | + <input type="hidden" name="metasync_save_auto_redirect" value="1"> | |
| 891 | + <?php if ($auto_redirect_current) : ?> | |
| 892 | + <span style="color: var(--dashboard-text-secondary, #9ca3af); font-size: 13px;">Redirects are created automatically when a post or page slug changes.</span> | |
| 893 | + <?php else : ?> | |
| 894 | + <span style="color: var(--dashboard-warning, #f59e0b); font-size: 13px;">Auto-redirects are paused. Slug changes will not create redirect rules (useful during migrations or bulk edits).</span> | |
| 895 | + <?php endif; ?> | |
| 896 | + </form> | |
| 897 | + </div> | |
| 898 | + | |
| 873 | 899 | <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> |
| 874 | 900 | <form id="redirection-form" method="post" action=""> |
| 875 | 901 | <?php wp_nonce_field('metasync_redirection_form', 'metasync_redirection_nonce'); ?> |
| 876 | 902 | <?php include "metasync-add-redirection.php"; |
| @@ -915,9 +941,9 @@ | ||
| 915 | 941 | |
| 916 | 942 | <div class="metasync-search-box"> |
| 917 | 943 | <label class="screen-reader-text" for="redirections-search-input">Search Redirections:</label> |
| 918 | 944 | <input type="search" id="redirections-search-input" name="s_redir" value="<?php echo esc_attr($list_state['s_redir'] ?? ''); ?>" placeholder="Search redirections..."> |
| 919 | - <input type="submit" id="redirections-search-submit" class="button" value="Search"> | |
| 945 | + <input type="submit" name="search_submit" id="redirections-search-submit" class="button" value="Search"> | |
| 920 | 946 | </div> |
| 921 | 947 | </div> |
| 922 | 948 | |
| 923 | 949 | <!-- Now we can render the completed list table --> |