Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to create an action hook to detect device.

When hook detect any device like mobile/tablet/iPhone then it load mobile specific short-code file otherwise its load normal short-code file.

For Example:

add_action( 'wp', 'detect_device' );
function detect_device() {

    if(any mobile/tablet/iphone device detected) {
       // load mobile-shortcode-file.php
    } else {
       // load normal-shortcode-file.php

How can i achieve this? Thanks in advance mates.

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.