How To Add WPDisquz To Custom Locations With A Shortcode

Published: 11 months ago

In this will guide, we're going to show you how to create a short code for the wpDiscuz, allowing you to custom position comments anywhere on your single post or custom post type. The wpDiscuz is a great tool for comment management on high traffic WordPress websites, and it's the one that we use on this blog. If you want to add it to a custom location on your WordPress website, creating a short code for wpDiscuz, and then placing that shortcode anywhere on the page is a great way to do that.

To create a shortcode for wpDiscuz, it's no different than creating a short code for the standard WordPress comments feature. The reason behind this is due to the fact that the wpDiscuz simply replaces the standard WordPress comments PHP with its own. Therefore, anywhere a normal WordPress comments section shows up on the site, the wpDiscuz will replace it with its own design and functionality.

So, to create a short code for wpDiscuz, all you need to do is paste in the following code, which is a direct copy of the code used to create a custom WordPress comments shortcode.

This code (source) should be added to your functions.PHP on your child theme, or by a code manager like Advanced Scripts (recommended method). It should be loaded in on “plugins loaded”.

 * Display the comment template with the [wpse_comments_template] 
 * shortcode on singular pages. 
 * @see
 add_shortcode( 'wpse_comments_template', function( $atts = array(), $content = '' )
    if( is_singular() && post_type_supports( get_post_type(), 'comments' ) )
        add_filter( 'comments_open',       'wpse_comments_open'   );
        add_filter( 'get_comments_number', 'wpse_comments_number' );
        return ob_get_clean();
    return '';
}, 10, 2 );

function wpse_comments_open( $open )
    remove_filter( current_filter(), __FUNCTION__ );
    return false;

function wpse_comments_number( $open )
    remove_filter( current_filter(), __FUNCTION__ );
    return 0;

Now, if you want to place your wpDiscuz comments section anywhere on your website, simply paste in the following short code, navigate to the front end, and see the comments section in the new position.


TESTED WORKING JAN 2021 (Oxygen Builder, Elementor)

Join Our Newsletter
Here's what you get: A once a week newsletter that contains original content, aggregated posts, WordPress deals, and anything else we think you'd like. We don't spam or sell your email address. Unsub at any time.
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
5 months ago

I tried this in Oxygen Builder and the comments do show up wherever the shortcode is placed. However, wpDiscuz still does not load on the backend or frontend. What do you mean when you say Working with Oxygen Builder? Is there another tutorial that gets wpDiscuz working with Oxygen?

3 months ago

Hello can i ask you a question. I used your code and workds fine but the bubble dissapeared.

isotropic black Friday deal finder

Search, sort, and filter through the best BFCM WordPress deals online.

Affiliate Disclosure: Some links on this website are affiliate links. We make commissions for purchases made through those links.

We only recommend items/tools that we've personally used and like.

Full Disclosure | FTC Statement

Join Our Newsletter
Over 4,000 Design Lovers and Problem Solvers.


A relationship driven website creation company.


© ISOTROPIC, LLC 2016-2021
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram