Articles of wp admin

How to do a query only on a specific admin page?

I’m making a page for settings API using Codestar Framework, and loading fields using their filterable configure – question is not related to Codestar. In one of such dropdown field, I need to load all the posts from a custom post type that are added within 30 days. To make the things nice and clean […]

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); […]

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 […]

WordPress admin notice in plugin function

i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook function it doesnt appears, where is the problem? class SomeClass { private static $instance; public function __construct() { add_action(‘woocommerce_saved_order_items’,array($this,’orderStatusChange’),10,1); add_action(‘admin_notices’, array($this,’simple_notice’)); // This works […]

Custom post type editor with dynamic selects, one drop down populating a second second drop down not working

I have a custom post type where I am attempting to have one select populate the options of a second select in the custom post type’s editor. The first drop down pulls in a list of tags associated to a different custom post type. The second drop down is suppose return a list of the […]

Change the Default Pages Menu View in wp-admin

I can’t seem to figure out how to change the default view for “Pages” in the admin menu. The initial view is the “Pages” view (/wp-admin/edit.php?post_type=page) How could it change this to something else? Like “Add New Page”? (/wp-admin/post-new.php?post_type=page) I’ve tried several different options including rebuilding the menu with a custom menu, but it seems […]

Custom Theme Want To Remove One Category From All Displays

I created my own custom WordPress theme for my website, everything is great. However, I have a strange need, I have one category which is kind of a ‘placeholder’ for content which is automated and used by an automated background process. Each time this process finds new content to put into that category I end […]

How could I execute my plugin just in frontend (not in backend)

I don’t need my plugin running through wp-admin, including wp-login. How could I prevent it? is_admin works fine but i don’t know how to ignore everything related to wp-admin (like wp-login.php). Thanks.

How to change “wp-admin” to something else without search-replacing the core?

for example: instead of How would I do that? I’ve tried using this in htaccess but it won’t work: ##### ABOVE THIS POINT IS ALREADY INSERTED BY WORD PRESS ##### Admin Base Rewrite ##### RewriteCond %{REQUEST_URI} wp-admin/ RewriteCond %{QUERY_STRING} !sercretword RewriteRule .*\.php [F,L] RewriteCond %{QUERY_STRING} !secretword RewriteRule ^secret_room/(.*) wp-admin/$1?%{QUERY_STRING}&secretword [L] ##### End Admin […]

Adding Visibility Options

I’ve searched for plugins but while some do halfway accomplish the task they are normally very complicated. I’d like to add option to the visibility menu when creating a page (and post, but page is more urgent). These options need to be: “Only visible to logged user” and “Only visible to guest (i.e. not logged […]