Support » Plugin: Ads by » Critical Bug: Ad orderby=random not functioning

  • Resolved WCVendors



    echo dfads( 'groups=123&limit=1' );

    There are 2 banners in group #123, both 468×60 banners. It will only display one banner, never the other. With orderby=random included in the PHP, it still does not randomize the ad. It only shows one ad.

    Critical bug? error in PHP code?



Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author datafeedr


    Sounds like a conflict with a caching plugin. Try adding &return_javascript=1 to your line.

    echo dfads( 'groups=123&limit=1&return_javascript=1' );

    No go! Updated the PHP as you suggested, and only shows the one ad….,ZT1Dkr8#0,ZT1Dkr8#1

    (Settings page, and output, refreshed 20 times, control+reload, different browsers, etc… There are no caching plugins on this site, no W3 or SuperCache or anything like that)

    Plugin Author datafeedr


    What is the exact code you are using in your template file?

    echo dfads( ‘groups=123&limit=1&return_javascript=1’ );

    Plugin Author datafeedr


    Please use echo dfads( 'groups=123&limit=1&return_javascript=1&orderby=random' );

    If that doesn’t work, it could mean your MySQL’s ORDER BY RAND() function is disabled.

    Thanks for your continued and fast updates. As another plugin developer, I appreciate that and thank you. 🙂

    Updating the PHP to:
    echo dfads( ‘groups=123&limit=1&return_javascript=1&orderby=random’ );

    Only shows the one ad so far. The webhost for this site is — I’d guarantee that their mysql is configured properly as other features on the site use it (such as displaying random products).

    I will install the plugin on another site not hosted by and see if it works and get back with you.


    Confirmed: Installed plugin on a server that is not with and the random order works just fine. I’ll have the client report the issue to wpengine to fix.

    Thanks for your help!

    For anyone else having this issue with wpengine, here are the steps to fix it.

    Enable rand() from within that wpengine specific panel. Note: It will not work on your *staging* site only your *live* site.

    In 15 years I’ve never seen a webhosting company work this way, but, alas, the problem is resolved. I’m still scratching my head a bit. 😉


    Plugin Author datafeedr


    Hi WCVendors

    Thanks for offering a solution to this issue. Hopefully this will help others who are hosted with WPEngine.

    We’ve seen a lot of our Datafeedr customers have issues with WPEngine and their highly tweaked server config. We’ve actually had to exclude support for WP Engine sites because of their odd handling of mod_rewrite.

    Anyway, glad you got your issue resolved.


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Critical Bug: Ad orderby=random not functioning’ is closed to new replies.