Only allow administrators and editors to access wp-admin

I am trying to restrict access to wp-admin so that only administrators and editors are allowed. At the moment I am using this function: function restrict_admin(){ //if not administrator, kill WordPress execution and provide a message if ( ! current_user_can( ‘manage_options’ ) ) { wp_die( __(‘You are not allowed to access this part of the … Read more

Why is there an intermediate redirect to https://public-url.org/wp-admin?

I have the SITE_DOMAIN set as foo.example.com, this has a SSL for *.example.com http://example.org, is the url for the frontpage, this works. There is no certificate for example.org. Now, when I access http://example.org/wp-admin the following happens: Redirect from http://example.org/wp-admin to https://example.org/wp-admin Client (browser) issues a certificate warning, there is no certificate for example.org. Client must … Read more

Invalid post type when click “Filter” or “Apply” button in WordPress admin Post list [closed]

Closed. This question is off-topic. It is not currently accepting answers. Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question? Closed 5 years ago. Improve this question I need your help to resolve … Read more

How can I make my .htaccess file writeable by wp-admin?

My ISP changed the hosting for my WordPress blog and everything stopped working. There was a DNS issue but they resolved that, but then every page apart from the home page returned a 404 error. When I checked the permalinks page (/wp-admin/options-permalinks.php) in wp-admin I saw the following: If your .htaccess file were writable, we … Read more

WP-Admin edit.php & post.php slowdown after import of 10k users

Situation: Clean wordpress install No plugins VPS server 5.2ghz / 4gb RAM (Default Directadmin) Import of 10k users Problem: WP-Admin edit.php and post.php take >4sec to load. A custom post type without the ‘Author’ support loads quickly What I tried: https://core.trac.wordpress.org/ticket/28160, didn’t work Question: What to do to get it fast again? 1 Answer 1 … Read more

How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?

Good day! I try to make display post counter for WordPress. Output count of views function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0”; } return $count.”;} register view function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); … Read more