• I have a basic shortcode plugin. I noticed that the shortcode was being rendered twice, and so added a couple log statements to my plugin; they are logged 6 times when I am rendering a single page.

    I tried turning off my plugin, and added a log statement to a different plugin; it was called the same number of times.

    I notice that the number of calls varies between different types of pages (e.g. single post is only 4; the home page is 3; etc.)

    Adding log statements to the template files themselves hasn’t yielded any clues so far. I don’t see evidence of double loops. A log statement in page.php is printed only once.

    What’s going on here?

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Reuben

    (@reuben)

    Also, I tried turning off all other plugins, 2 or 3 at a time; the issue wasn’t fixed by the absence of any.

    Thread Starter Reuben

    (@reuben)

    BUMP. This is not fixed by changing templates either.

    Have you contacted the plugin author?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Which plugin is it or is it something you’ve written?

    And seriously, don’t bump.

    Thread Starter Reuben

    (@reuben)

    It’s my own plugin. It literally is doing nothing but debugging a log statement (and similar same happens in all plugins).

    And seriously, I’ll bump if there’s no activity in a week on a question.

    Thanks

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Are you doing an add_filter or add _action an when in the loop do you want it to run? After the wp_head in the main loop?

    As you’ve found out the plugin is getting called more times than you thought it would. If you can narrow down where you want it to run you could add conditionals to limit when the plugin should be implemented.

    And seriously, I’ll bump if there’s no activity in a week on a question.

    Well then. Good luck with your problem.

    Thread Starter Reuben

    (@reuben)

    Actually I just hacked up a backtrace debug function; this identical stack is output multiple times per page. Thus I think this must be outwith wordpress itself.

    file=memberprofile.php, line=56, function=dbug
    file=wp-settings.php, line=192, function=include_once
    file=wp-config.php, line=87, function=require_once
    file=wp-load.php, line=29, function=require_once
    file=wp-blog-header.php, line=12, function=require_once
    file=index.php, line=17, function=require

    > Well then. Good luck with your problem.

    There’s a stick somewhere near your posterior that needs to be freed.

    Thread Starter Reuben

    (@reuben)

    Alright, wp-ecommerce was the plugin causing the three index calls. Disabling that reduced by half the number of calls to the plugins.

    I still have two calls to plugins from pages; debugging now.

    [17-Dec-2011 13:15:22] file=functions.php, line=4580, function=whereCalled
    file=memberprofile.php, line=56, function=dbug
    file=wp-settings.php, line=192, function=include_once
    file=wp-config.php, line=87, function=require_once
    file=wp-load.php, line=29, function=require_once
    file=wp-blog-header.php, line=12, function=require_once
    file=index.php, line=17, function=require

    [17-Dec-2011 13:15:22] initialized
    [17-Dec-2011 13:15:22] test
    [17-Dec-2011 13:15:22] file=functions.php, line=4580, function=whereCalled
    file=memberprofile.php, line=56, function=dbug
    file=wp-settings.php, line=192, function=include_once
    file=wp-config.php, line=87, function=require_once
    file=wp-load.php, line=29, function=require_once
    file=wp-cron.php, line=26, function=require_once

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘My plugin is called six times!’ is closed to new replies.