Title: Attachment post type
Last modified: September 1, 2016

---

# Attachment post type

 *  Resolved [Alex](https://wordpress.org/support/users/flyjam/)
 * (@flyjam)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/attachment-post-type-1/)
 * Hi Hector!
 * I’m trying to set the Post type as ‘attachment’ both on the Stat page and in 
   the widget options. Apparently the plugin counts views on the attachment pages
   and I can output them by the function `echo wpp_get_views( $post->ID )`, but 
   cannot I watch the stats and output the popular attachments list from the widget?
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/attachment-post-type-1/#post-7591280)
 * Hi Alex!
 * Yep, that’s because WPP queries the database for post type(s) with status _publish_(
   ed), while the _attachment_ post type uses the status _inherit_.
 * WPP registering views count for attachments is actually an accident 😛 I’ve been
   aware of that for quite a while and decided to leave it as it is since a couple
   of users out there had the same idea as you (show a list of the most popular 
   attachments).
 * Since there’s no way to programmatically tell WPP to retrieve posts with a different
   status than _publish_, if you want to display the most viewed attachments you’ll
   have to mod WPP:
    1. Go to _Plugins > Editor_ and pick **WordPress Popular Posts** from the dropdown
       at the right.
    2. Find [this line](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/wordpress-popular-posts.php#L1763)
       and change the ‘publish’ bit to ‘inherit’.
    3. Hit the Update file button to apply changes.
 * Note that this is only a temporary workaround. When updating plugins, WordPress
   overwrites all the old files with the new ones and so any customizations made
   directly into plugin’s code will be lost. Also, in WPP’s case I’m currently refactoring
   its code which means that the mod above will be outdated soon (I’m pointing this
   out for future visitors, just in case).
 * I’ll consider adding a _status_ parameter/option on a future release, shouldn’t
   be too hard to implement.
 *  Thread Starter [Alex](https://wordpress.org/support/users/flyjam/)
 * (@flyjam)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/attachment-post-type-1/#post-7591336)
 * Actually it’s very good that attachment views are counted, even by the accident
   🙂 I also inevitably need it for attachment pages. Hope you could add a status
   option in the future, at least some, including myself, would be very happy ^)
 * And thank you, Hector, for the quick tip as a temporary solution.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Attachment post type’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Alex](https://wordpress.org/support/users/flyjam/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/attachment-post-type-1/#post-7591336)
 * Status: resolved