CMS Tutorial:How to Stop user from cagetory deletion
WordPress is like a heaven for the programmer and for designer both. With the introduction of wordpress, blogging moves to next level . All of us know that wordpress is highly customizable and in any manner but there are several things which becomes pain for the beginner developer or wordpress programmer.
One of the reason for the pain is, “Categories”. Categories helps us in grouping the posts so it is easy for manage and beneficial for reader and for programmer also. But sometimes it happens that programmer creates a category which is treated as top level category , which we dont want to delete anyhow , so as to maintain the smooth functionality of our blog / site, as we can create custom files for categories on the basis of category slug / ID and so on.
So overcome the fear of category deletion , we can write some piece of code in our theme’s functions.php file , which will helps us to overcome the fear of category deletion .
The piece of code for preventing the category deletion is provided below :
As you can see , you just have to pass the array of category id’s in the first line and then no one is able to delete the defined category from wp-admin .
WordPress is like a heaven for the programmer and for designer both. With the introduction of wordpress, blogging moves to next level . All of us know that wordpress is highly customizable and in any manner but there are several things which becomes pain for the beginner developer or wordpress programmer.
One of the reason for the pain is, “Categories”. Categories helps us in grouping the posts so it is easy for manage and beneficial for reader and for programmer also. But sometimes it happens that programmer creates a category which is treated as top level category , which we dont want to delete anyhow , so as to maintain the smooth functionality of our blog / site, as we can create custom files for categories on the basis of category slug / ID and so on.
So overcome the fear of category deletion , we can write some piece of code in our theme’s functions.php file , which will helps us to overcome the fear of category deletion .
The piece of code for preventing the category deletion is provided below :
As you can see , you just have to pass the array of category id’s in the first line and then no one is able to delete the defined category from wp-admin .
No comments:
Post a Comment
Please leave your comments and we will be reply you back ASAP
vikas agrawal