WordPress Warning: Cannot modify header information” in WordPress

This error happens when you try to modify HTTP headers. WordPress functions that will modify HTTP header are, wp_redirect(), wp_safe_redirect() etc. Make sure you modify the HTTP header before the output is made, also check for white spaces before . For plugin and theme developers, make sure you buffer the output from php scripts in […]

How to include CSS and JavaScript in WordPress

A WordPress developer should know how to include stylesheets and JavaScript files in WordPress plugins or themes. WordPress has its own functions to include CSS and JavaScript. I’ve seen many developers use like

and

directly to their themes and plugins. This is not at all the right way. The best practice is use […]

Publish post hook for custom post type

publish_post is an action hook triggered whenever a new post is published.   The ‘publish_post’ action is post type specific. So if you have a custom post type, you need to change the hook you use. if your post type is portfolio, the hook you should use is publish_portfolio