Request a Call back


Must Try WordPress Functions: Most Useful, but Overlooked

If you are developing plug-in then this function is best use for you. Plug-in developers need to specify about refreshing the rewrite rule by visiting Permalinks options page and push the save changes button, nevertheless have made none of the changes. How it looks? Better alternative is creating a code to flush the rewrite rules own self using flush_rewrite_rules() function.

How to implement it in practice:

Here is a code that is used to rewrite rule itself.
// Register Custom Post Type
function portfolio_cpt() {
register_post_type( ‘portfolio’,
‘labels’ => array(
‘name’ => __( ‘Portfolios’, ‘my-locale’ ),
‘singular_name’ => __( ‘Portfolio’, ‘my-locale’ )
‘public’ => true,
‘has_archive’ => true,

add_action( ‘init’, ‘portfolio_cpt’, 0 );

function myplugin_activate() {

register_activation_hook( __FILE__, ‘myplugin_activate’ );

function myplugin_deactivate() {
register_deactivation_hook( __FILE__, ‘myplugin_deactivate’ );
The function is using highest server space among the all the functions in WordPress. It is recommended to use it on the activation and deactivation of your plugin or theme.

How to Detect Mobile Visitors of your Website in WordPress?

Do you want to keep watch on who is visiting your site from the mobile source, then here is a function that detecting mobile visitors of your website. You can track the mobile visitors record by wp_is_mobile() function.

How to implement it in practice:

if( wp_is_mobile() ) {
} else {
// don’t echo the banner

How to enqueue CSS in WordPress?

When you’re plug-in or theme needing variable or inline style, what you do? You start to write it using wp_enqueue_style()and start enqueuing inline or what!! Well, here I am to provide the best way to do it with slick using wp_add_inline_style() which helps you by letting you include inline CSS style. As simple as adding importing any file into the code!!!

How to implement it in practice:

$custom_style_file = get_template_directory_uri() . ‘/css/custom_style.css’;

function custom_styles() {
wp_enqueue_style( ‘custom-style’, $custom_style_file );
$headline_font_weight = get_theme_mod( ‘headline-font-weight’ );
$custom_style = ‘.headline { font-weight: ‘ . $headline_font_weight . ‘; }’;
wp_add_inline_style( ‘custom-inline-style’, $custom_style );
add_action( ‘wp_enqueue_scripts’, ‘custom_styles’ );

WordPress function to check that you are in the loop

Whenever you develop any plug-in or theme you may check that your code must run in the loop. Here I have an easy way to nail it by using in_the_loop() function which will increase your efficiency.

How to implement it in practice:

if( in_the_loop() ) {
// do something loop-related
} else {
// don’t do anything or display some kind of error/warning

Well, Here I am ending up with the wish that it would be helpful to you by any means. I will take out some more such an overlooked stuff, so keep following my articles to know more and more and more.

Leave a Reply

Your email address will not be published.

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Answers


Our Counsellors can Answer Any Queries.

 Just Request a Call

Thank you

Calling you Soon