Title: Widget works but shortcode doesn&#039;t
Last modified: August 21, 2016

---

# Widget works but shortcode doesn't

 *  [iamali](https://wordpress.org/support/users/iamali/)
 * (@iamali)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/)
 * Hey,
 * Got everything set up nicely – popped a widget in the sidebar & it works fine
   getting the 5 latest posts. Tried to do a shortcode however & it doesn’t work–
   all it brings back is one link for the front page even though it’s set to just
   bring back posts only, not pages.
 * My code is this:
 * `<?php echo do_shortcode("[google_top_content pageviews=0 number=5 showhome=no
   time=2628000 contentfilter=post]"); ?>`
 * Any ideas?
 * Thanks!
 * [http://wordpress.org/plugins/google-analytics-top-posts-widget/](http://wordpress.org/plugins/google-analytics-top-posts-widget/)

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/page/2/?output_format=md)

 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500255)
 * Are you still having issues with this? Are the settings you’re using in the shortcode
   the same settings you have in the widget?
 *  [alesub](https://wordpress.org/support/users/alesub/)
 * (@alesub)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500320)
 * Same thing over here. I’m pasting the shortcode provided in the description of
   the plugin’s page but it doesn’t render anything.
 * The widget however works great.
 * I’m starting to dig into the code, I’ll post if I find anything else.
 * Thanks!
 *  [alesub](https://wordpress.org/support/users/alesub/)
 * (@alesub)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500321)
 * The only useful data I can provide right now is that the shortcode outputs
 *  despite if it’s using transtient or not. I couldn’t spot exactly where the code
   is exiting without getting the data correctly like the widget.
 * Note on the side: Adding “update” as a parameter in the shortcode as suggested
   in google-analytics-top-posts-widget.php at line 132 didn’t forced the transtient
   to be skipped, seems like the parameter is getting lost after applying the filters.
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500322)
 * What is the site you have this installed on? Specifically the page with the shortcode/
   widget.
 *  [JureCuhalev](https://wordpress.org/support/users/jurecuhalev/)
 * (@jurecuhalev)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500326)
 * Having same problem here. Just using:
 * `<?php echo do_shortcode('[google_top_content pageviews=50 number=10 showhome
   =no time=2628000 timeval=2]'); ?>`
 * returns
 *     ```
       <!-- not using transient -->
       <ol></ol>
       <!-- not using transient -->
       ```
   
 * but the widget works (and is also not using transient). I’ll continue looking
   through code if I can figure out what’s going on.
 * I’m trying to build custom rss feed, so it’s not in a context of page/post.
 *  [griffi1r](https://wordpress.org/support/users/griffi1r/)
 * (@griffi1r)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500347)
 * I am just using the shortcode on the page, but get the same issue as you guys.
   When I check the source code, I also see
    <!– not using transient –>
 * <!– not using transient –>
 * Any ideas Justin Sternberg?
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500348)
 * Hi, Thanks for the great plugin. The widget works fine but I can confirm the 
   shortcode doesn’t work for me either. I am getting “using transient” however:
 *     ```
       <!-- using transient -->
       <ol></ol>
       <!-- using transient -->
       ```
   
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500353)
 * My shortcode works fine now. I probably had a caching issue. I installed and 
   ran the plugin [Artiss transient cleaner](http://wordpress.org/plugins/artiss-transient-cleaner/)
   and after that the posts showed up with the shortcode.
 *  [hki429](https://wordpress.org/support/users/hki429/)
 * (@hki429)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500357)
 * I have the same problem as Mr Press, with no list generated with the shortcode(
   though the widget works okay) and the following HTML source code:
 *     ```
       <!-- using transient -->
       <ol></ol>
       <!-- using transient -->
       ```
   
 * However, the transient cleaner plugin did not solve it for me. Anyone got another
   idea what might cause this?
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500358)
 * [@hki429](https://wordpress.org/support/users/hki429/)
 * There are a few things you may try. Make sure the GA Top content widget is deleted.
   Clear out all transients, not only those that have expired. Check that Google
   Analytics Dashboard is showing stats for your posts in the posts list in wp-admin.
   If you are using the plugin Bulletproof security [make changes](http://forum.ait-pro.com/forums/topic/google-analytics-dashboard-google-analytics-data-will-not-load/)
   to the wp-admin .htaccess-file or remove the wp-admin .htaccess-file, which I
   had to do. Open your database sql-file in an editor like Notepad++ and search
   for “google_top_content”. You should find `_transient_timeout_dw-gtc-list-google_top_content`
   and `_transient_dw-gtc-list-google_top_content` where the most viewed posts should
   be listed. Make sure your shortcode has the correct format, like:
 * `<?php echo do_shortcode( '[google_top_content pageviews=10 number=5 contentfilter
   =post showhome=no time=2628000]' ); ?>`
 * If you for example put a pageviews number which is higher than the highest number
   of visits to your posts, nothing will show.
 * Hope this helps.
 *  [prometheangroup](https://wordpress.org/support/users/prometheangroup/)
 * (@prometheangroup)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500359)
 * We are seeing exactly the same bug as above. we have cleared out transients. 
   Still getting the “using transient” bug with no top content data. We have uninstalled
   the plugin and we have even reverted back to the 1.4.8 version of the plugin.
   Still the same bug exists, providing no data, just the “using transient” bug.
 * We have tried numerous different fixes, including the exact example shortcode
   on the plugin page with the same results and yes, all of our posts have more 
   far more than 5 views. Also, please note that this plugin was working great before
   the 3.8.1 upgrade.
 * Also strange is that the daskboard top-content widget is working fine, so that
   leads us to believe it is just a simple bug in the shortcode that is not compatible
   with WordPress 3.8.1.
 * What is the status of getting this shortcodes bug fixed?
 * Appreciate your help and will gladly contribute a donation, if you can get this
   fixed in a timely fashion… Yes, that is a bribe.
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500361)
 * [@prometheangroup](https://wordpress.org/support/users/prometheangroup/)
 * I would not be so quick to label this as a bug. I had some difficulties getting
   the shortcode to work, but once I found out how the plugin functions I got the
   shortcode working the way to be expected. As a number of people here have reported
   difficulties perhaps the plugin isn’t running smoothly in all circumstances, 
   but I wouldn’t label the shortcode problem as a bug nevertheless.
 * Have you tried to disable all your other plugins one by one to see if another
   plugin causes the problem with the shortcode? Do you have a .htaccess security
   plugin installed which may interefe with the Google Analytics Dashboard plugin?
   It’s very common for faulty plugins to interfere with other plugins.
 *  [prometheangroup](https://wordpress.org/support/users/prometheangroup/)
 * (@prometheangroup)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500362)
 * Yes, we tried all of the standard tricks both in dev and test, (test is an exact
   hw/sw replica of production), as is SOP for any CMS issue logged.
 * We certainly can sympathize with your desire to rename this (whatever you are
   wanting to call it) something more politically correct, other than a “bug.” It
   appears your definition of a bug is more narrow than ours, and we should probably
   adopt your “softer” stance on “name-calling” of these topics (avoiding the dreaded“
   B” word) as these gracious plug-in developers are largely unpaid and exceedingly
   under-appreciated.
 * Suffice it to say, we greatly appreciate both the plug-in developers and anyone
   who positively contributes to any of the related forums. And of course, we are
   a consistent monetary donator to many of the contributors to this as well as 
   various other open-source communities.
 * So to get any future forum-good-samaritans more up to speed on where we are, 
   and avoid suggesting already tried stuff, we believe we’ve narrowed it down to
   a database residuals issue from legacy plugins that have somehow created “stealth-
   conflicts” in migrating to 3.8.1. This is due to the fact that this site has 
   a fairly lengthy history and countless plugins were installed and then uninstalled,
   but as you know, can unfortunately leave residual data in mySQL.
 * We’re probably going to stop debugging (oops! I mean de-investigating) this topic
   because we were able to just reverse-engineer the working plugin code in the 
   CMS console that does essentially the same thing and write our own [shortcode].
 * Nonetheless, if we do happen to find the issue and related patch / fix on another
   one of our WP instances, we’ll post the solution here for posterity.
 * Thanks!
 *  [hki429](https://wordpress.org/support/users/hki429/)
 * (@hki429)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500364)
 * [@mr](https://wordpress.org/support/users/mr/) Press
 * Thank you! If I remove the `_transient_timeout_dw-gtc-list-google_top_content`
   and `_transient_dw-gtc-list-google_top_content` transients every time I make 
   a change to the shortcode, the shortcode works and changes are visible.
 * Thanks again.
 *  [hki429](https://wordpress.org/support/users/hki429/)
 * (@hki429)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/#post-4500390)
 * > If I remove the _transient_timeout_dw-gtc-list-google_top_content and _transient_dw-
   > gtc-list-google_top_content transients every time I make a change to the shortcode,
   > the shortcode works and changes are visible.
 * Since version 1.5.2 I cannot find these transients anymore in the wp_options 
   table. Anyone knows how I can remove the transients so that the plugin can be
   configured correctly, instead of keeping the layout it showed the first time 
   upon activation?

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/page/2/?output_format=md)

The topic ‘Widget works but shortcode doesn't’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-analytics-top-posts-widget.
   svg)
 * [Google Analytics Top Content Widget](https://wordpress.org/plugins/google-analytics-top-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-analytics-top-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 23 replies
 * 8 participants
 * Last reply from: [hki429](https://wordpress.org/support/users/hki429/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/widget-works-but-shortcode-doesnt/page/2/#post-4500405)
 * Status: not resolved