I can’t access my admin page after changing main url

Not sure why you would want to make that change, but if worst comes to worst, you can change it back via the database. Assuming you can access your MySQL database directly, simple navigate to the wp_options table and change the value of siteurl and/or home to your desired values. EDIT: Alternatively, if you can … Read more

How to control contextual help section by code?

You could also trigger/simulate the help button being clicked by binding to the ready event. Pre jQuery 1.7 <script type=”text/javascript”> jQuery(document).bind( ‘ready’, function() { jQuery(‘a#contextual-help-link’).trigger(‘click’); }); </script> jQuery 1.7+ (bind deprecated as of 1.7) <script type=”text/javascript”> jQuery(document).on( ‘ready’, function() { jQuery(‘a#contextual-help-link’).trigger(‘click’); }); </script> The difference here is that you’ll see the help section slide down … Read more

Is it possible to set a option, and then redirect to another page directly from a admin notice link?

You could use /wp-admin/admin-post.php. Link: $url = admin_url( ‘admin-post.php?action=somethingunique’ ); print “<a href=”https://wordpress.stackexchange.com/questions/85825/$url”>Update and redirect</a>”; Then you should register a callback for that action: add_action( ‘admin_post_somethingunique’, ‘wpse_85825_callback’ ); And in that callback you can do what you want: function wpse_85825_callback() { if ( current_user_can( ‘manage_options’ ) ) update_option( ‘my_option’, ‘some_value’ ); wp_redirect( admin_url( ‘users.php’ ) … Read more

Restrict access in wp-admin area?

that depends on if you want to redirect users away the you should use init hook since no output or headers are sent before that hook. or if you want to display a nice “You Don’t have the right permissions to access this page” message then you can use the wp_head action hook: //display meassage … Read more

Remove HTTP: from the site URL and just keep // in it

To remove http: and https: from all links, use the following script: add_action( ‘plugins_loaded’, ‘wpse_232287_init’ ); function wpse_232287_init() { // Initiate the function ob_start( ‘wpse_232287_remove_http’ ); } function wpse_232287_remove_http( $buffer ) { // Check for a Content-Type header, only apply rewriting to “text/html” or undefined $headers = headers_list(); $content_type = null; foreach ( $headers as … Read more

WP-admin giving 404

Since you rename the original plugin folder and create a blank plugin then it works. If in case log file is not immediately reflecting the error or it is not obvious for identifying the error. Moving the disabled plugin one by one to the new empty plugin folder is another way to find out which … Read more