Is it safe to post form data via Ajax to the settings api? Am I missing something?

WordPress does not natively use Ajax submits with Settings API, so there isn’t really best practice for it. I remember scbFramework having such option, but it was removed. Essentially there is nothing inherently more insecure to such submit, you should treat form data as untrusted regardless of submit method and appropriately sanitize and validate it … Read more

how to redirect to url.com/wp-admin if url.com/admin is typed in?

Hook into template_redirect, inspect the request URI, and redirect to the return value of admin_url(). add_action( ‘template_redirect’, function() { $request = untrailingslashit( strtolower( $_SERVER[‘REQUEST_URI’] ) ); if ( ‘admin’ === $request ) { wp_redirect( admin_url() ); exit; } }); Note: always use admin_url() and the other built-in URL functions, because they will take care of … Read more

Is there a way to have admins that are logged in to wordpress not have to enter the password for password protected pages while browsing the website?

Since 4.7 you can filter the post_password_required function: function my_admins_dont_need_password( $required ) { if ( current_user_can( ‘manage_options’ ) ) { $required = false; } return $required; } add_filter( ‘post_password_required’, ‘my_admins_dont_need_password’ ); Replace manage_options with whatever capability you want to use to allow users to skip the password form.

Adminstering Large Number of WordPress Sites

Well it depends on how/where they are hosted. If if they are hosted on different servers or the same I would still use the command line and a script file. If they all have different usernames/passwords you going to have to write a lot. Pre-planning will save you a ton of time in maintenance. First … Read more

Any way to inherit methods from both my plugin class and WP_List_Class?

This is a common design pattern, and I would have solved it in the same way you did. Let My_WP_List_Class extend WP_List_Class, and pass a “configuration” object to it. You could even make the relation more explicit by defining an interface your configuration object must adhere to: interface My_WP_List_Configuration { public function get_name(); public function … Read more

What is the optimal way to filter out subpages from admin?

This works for our needs: # Parent filtering function wps_restrict_manage_posts() { global $typenow; # only run this filter on page post type if ( $typenow == ‘konverentsid’ ) { # Parent Page Filter (HTML) $args = array( ‘post_type’ => ‘konverentsid’, ‘child_of’ => 0, ‘show_option_none’ => __(‘Show all pages’), ‘depth’ => 1, ‘name’ => ‘wps_page_filter’, ‘selected’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)