Support » Plugin: Admin Columns » Accessing Data From Admin Columns

  • Resolved jtcheng



    I’m pretty impressed with this plugin. In particular, I’ve noticed that this plugin accurately counts custom post submissions and comments submissions by user.

    My question is this:
    Since the plugin does such a great job of acquiring this information (custom post type count and comments count per user), I was wondering how would I able to acquire this information so I could populate an ACF Field that would allow me to display such meta information on the website front end?

    Or asked another way, how does Admin Columns acquire this information in the first place? And would I be able to somehow mimic this algorithm to store such info in ACF field dynamically?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Stefan van den Dungen Gronovius


    Hi there,

    Thanks for your feedback on our plugin.
    We get the count for both the posts and comment in our column by doing a query.
    I put those functions into a codeshare so you can use it for your own.

    If you want to store this information in a custom field, it would probably be a good idea to update the count on each comment save or post save. Or you could of course just run this method on your front-end, since the query is not that heavy on performance.

    Thread Starter jtcheng


    Thank you for your feedback and for sharing the code. I was successfully able to implement this.

    Last question though.

    I used the ‘init’ hook to execute the function to update the post and comment counter metafield value like so:
    add_action(‘init’, ‘update_user_contribution_counts’);

    I have a feeling that wasn’t the best way to do it.

    If I wanted this action to hook into a change in the database (e.g. a new post, a new comment, a deleted post, a deleted comment, etc.), what is the proper hook that I should have used to achieve this?

    Plugin Contributor Stefan van den Dungen Gronovius


    I think that init is indeed not the right hook to use in this case.
    The following hook would probably be the best hook to use.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Accessing Data From Admin Columns’ is closed to new replies.