0

Goodman asked:

When searching for a way to connect an action to plugin install (not activate), I saw two action hooks in plugin-install.php. one is install_plugins_{$tab} and the other is install_plugins_pre_{$tab}.

Could you tell me what exactly is $tab referring to in this case? How can I associate my function to the ajax installation in this case?

3
  • 1
    Whose question is that? Yours?
    – fuxia
    Commented Dec 25, 2016 at 12:38
  • It was from the comments but deserves some detailed explanation. Will add the reference later.
    – prosti
    Commented Dec 25, 2016 at 12:39
  • 2
    Then please edit the question. It doesn't matter who asked it first. Also please improve your question title. Summarize your specific problem, do not include the word "question".
    – fuxia
    Commented Dec 25, 2016 at 12:40

1 Answer 1

1

If you go to the plugin-install.php inside the WordPress dashboard, there may be many tabs:

wp-admin/plugin-install.php?tab=featured
wp-admin/plugin-install.php?tab=popular
wp-admin/plugin-install.php?tab=recommended
...

plugin-install.php tabs

Here is the function you referenced:

File: wp-admin/plugin-install.php
145: /**
146:  * Fires after the plugins list table in each tab of the Install Plugins screen.
147:  *
148:  * The dynamic portion of the action hook, `$tab`, allows for targeting
149:  * individual tabs, for instance 'install_plugins_plugin-information'.
150:  *
151:  * @since 2.7.0
152:  *
153:  * @param int $paged The current page number of the plugins list table.
154:  */
155: do_action( "install_plugins_{$tab}", $paged ); ?>
156: 
157:    <span class="spinner"></span>
158: </div>

And $tab is actually what you get via $_GET['tab']:

File: wp-admin/plugin-install.php
08: // TODO route this pages via a specific iframe handler instead of the do_action below
09: if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
10:     define( 'IFRAME_REQUEST', true );
11: 

in our case the tabs would be:

featured, popular, recommended

based on the URL.

Related blitz quest:

Thank you. what about "tab=search"? my current problem is that when i start typing in the search box, once the plugin list appears, the various actions do not seem to apply.

This seems like a completely new action (read: new question). Have you tried the

action:query-themes

aka function:

wp_ajax_query_themes

If you need more help, you may create a new quest with details and someone may try to dig deeper.

2
  • Thank you. what about "tab=search"? my current problem is that when i start typing in the search box, once the plugin list appears, the various actions do not seem to apply. Commented Dec 26, 2016 at 15:05
  • @EranG, I tried to reply short, looks again like a new subject to research and discover, even though we have tab=search we have Ajax requests down below.
    – prosti
    Commented Dec 27, 2016 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.