Support » Plugin: Pods - Custom Content Types and Fields » does shortcodes impact performance

  • Resolved battarov

    (@battarov)


    Hi.
    in my project the site speed is very important and there will be thousand of posts to be migrated to the new site which is under development.
    I found there is a whole shorcodes system in pods to design templates.
    while its a great feature which will speed up the building process , but is there any affect to the site performance when we use templates over pure php.

    as an example in facetwp filtering plugin documentation they said that using their template builder is a plus for speed because it calles a separated api to enhance performance .

    So what is your advice regarding pods templating for mid to large sites.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Pods shortcodes use a fresh object each time you have a shortcode. If you have 100 shortcodes on a page (like an archive) then that can end up producing extra DB queries and additional memory usage.

    It’s not a huge amount depending on the use-case but I’ve always considered using PHP to be the most performant option if you are looking for scale and customization.

    For instance, instead of [pods name="your_pod" id="1234" field="your_field"] you would essentially use something like this: echo pods( 'your_pod', 1234 )->display( 'your_field' );

    However, for the best performance, you would want to set up your Pods object ahead of any loops. Here’s an example:

    
    $pod = pods( 'your_pod' );
    
    // start your loop logic here
    foreach ( $whatever as $id ) {
        $pod->fetch( $id );
    
        echo 'whatever you want';
        echo $pod->display( 'your_field' );
    }
    // end loop
    
    Thread Starter battarov

    (@battarov)

    thanks a lot, that was really helpfull.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘does shortcodes impact performance’ is closed to new replies.