WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] posts_request, admin or front-end (2 posts)

  1. AndreSC
    Member
    Posted 6 years ago #

    when using the 'posts_request' hook in a plugin, what is the best way to determine if the function has been called by the front-end or by the manage posts page in admin ?

    Thanx

  2. AndreSC
    Member
    Posted 6 years ago #

    I think the solution is if you have say
    add_filter('posts_request','myfunction');

    and you do not want your function to have any effects when posts are listed in e.g. Manage > Posts

    function myfunction() {
    	global $wp_query;
    	if(!$wp_query->is_admin) {
            // do front-end stuff here

Topic Closed

This topic has been closed to new replies.

About this Topic