the page automatically display a number inside a div called wpb_wrapper, when I use a custom shortcode. but its nowhere in my function. When I delete the shortcode the number goes away.

<div class="wpb_text_column wpb_content_element " >
    <div class="wpb_wrapper">


Any clues?

Is a custom Shortcode to display a grid of post, it contains PHP code, HTML tags and CSS.

function millennium_grid(){
   return include("mg-custom-grid.php");

add_shortcode('millennium', 'millennium_grid');
  • 1
    Which shortcode / plugin you are referring to? Can you be more specific? – huraji Nov 21 '18 at 15:23

You can't return an include like that. A successful include() itself returns 1, and since you're returning the return value of include, your shortcode is displaying "1".

Handling Returns: include returns FALSE on failure and raises a warning. Successful includes, unless overridden by the included file, return 1.


If you want to output a template or similar file from shortcode, you need to capture it with output buffering:

function millennium_grid() {

    include 'mg-custom-grid.php';

    return ob_get_clean();
add_shortcode( 'millennium', 'millennium_grid' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.