Posts in Category: snippets

Adding or Including custom post type to default WordPress loop

Adding or Including custom post type to default WordPress loop by altering the ‘pre_get_posts’ function. Here it use add_action() function. This will help to display those posts (custom posts) alongside the default posts in the regular post feed.

Add this in you functions.php file

 


How to Limit or Disable WordPress Post Revisions

Limit the number of posts revisions that WordPress stores in the database.

Post Revisions

edit wp-config.php file in WordPress root:

WP_POST_REVISIONS:

  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except


Disable update notification for individual plugins / All

code for the plugin file itself:-


I like to put this in the actual plugin. Since I’ve only ever disabled updates on a plugin because I’ve edited or forked the code and don’t want to lose my edits on an update, I’ve already edited the plugin and thus don’t


Limit character in content and title in wordpress

or with readmore

 


Hide page visual editor if certain template is selected

 


Remove Admin Menus

 


has_post_thumbnail() not working

Assuming that you’re in The Loop, you can fix this problem, by replacing:

with

 


Display admin menu urls – debug