Tips for Best Practices in WordPress Development

| Last Updated: | In: WordPress Snippets


How to log in a WordPress user programmatically

When you are building a WordPress based websites, it can be very useful to know how to programmatically log in a WordPress user. Here is a function that can do it easily.

Here is the function, drop it in your functions.php file:

Then, to log in a user, do the following:

How to Disable Google Fonts in WordPress

Google fonts are very more popluar, many developers employ it in WordPress theme,I have to say the WordPress dashboard also use google fonts.Now,there is a question that come in my head, how to disable google fonts in my WordPress?

Auto Login and Redirct to Custom page after WordPress Registration

If you want ro auto user login after registration and custom url for redirect after login, then use the below code snipats :

How to use PHP in WordPress widgets
Just add following snippet to your current theme’s functions.php file:

How to use shortcodes in WordPress sidebar widgets

I think you know it,shortcode is useful.But you may can’t use shortcode in sidebar widget.To allow shortcodes in sidebar widgets, simply edit the functions.php file from your them and add the following code:


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:

Tags: ,