Lubinik Learning

Training mode

Hooks, Lifecycle & Debugging

Time remaining:

0 / 16 answered

  1. 1. What is the essential difference between a WordPress action and a filter?

    Choose the statement that correctly describes the contract expected by WordPress.

    What is the essential difference between a WordPress action and a filter?
    Hint

    Ask yourself whether the received value must continue through the execution chain.

  2. 2. How does hook priority affect callbacks attached to the same hook?

    Assume all callbacks are valid and registered.

    How does hook priority affect callbacks attached to the same hook?
    Hint

    Compare numeric priority values.

  3. 3. Which checks belong in a save_post metabox handler?

    Select all generally appropriate safeguards.

    Which checks belong in a save_post metabox handler?
    Hint

    Consider request intent, autosaves, and authorization.

  4. 4. Which hook is appropriate when a plugin must initialize after all active plugins have loaded?

    Which hook is appropriate when a plugin must initialize after all active plugins have loaded?
    Hint

    Think about when every active plugin file has been included.

  5. 5. What happens if a filter callback forgets to return the filtered value?

    What happens if a filter callback forgets to return the filtered value?
    Hint

    Actions may ignore return values; filters may not.

  6. 6. What must match when removing a callback with remove_action()?

    What must match when removing a callback with remove_action()?
    Hint

    A callback registered at priority 20 cannot be removed as though it used priority 10.

  7. 7. What does the accepted_args parameter of add_filter() control?

    What does the accepted_args parameter of add_filter() control?
    Hint

    It describes callback input, not execution order.

  8. 8. Which function can check whether a particular action is currently executing?

    Which function can check whether a particular action is currently executing?
    Hint

    Distinguish currently running from already fired.

  9. 9. What does has_filter() return when a specific callback is registered?

    What does has_filter() return when a specific callback is registered?
    Hint

    The return value must distinguish priorities.

  10. 10. What does did_action( $hook_name ) report?

    What does did_action( $hook_name ) report?
    Hint

    It is a counter, not a boolean-only check.

  11. 11. Inside a shared callback, which function identifies the hook currently being processed?

    Inside a shared callback, which function identifies the hook currently being processed?
    Hint

    Useful when one callback handles several hooks.

  12. 12. What is the safest first check before modifying the public main query in pre_get_posts?

    What is the safest first check before modifying the public main query in pre_get_posts?
    Hint

    Avoid changing admin and secondary queries.

  13. 13. Why is init commonly used for rewrite-related registrations?

    Why is init commonly used for rewrite-related registrations?
    Hint

    Registration and flushing are different operations.

  14. 14. Which task is most suitable for the shutdown hook?

    Which task is most suitable for the shutdown hook?
    Hint

    It is late in the request.

  15. 15. When is do_action_ref_array() useful?

    When is do_action_ref_array() useful?
    Hint

    Compare it with call_user_func_array().

  16. 16. Why should attaching a callback to the special all hook be approached carefully?

    Why should attaching a callback to the special all hook be approached carefully?
    Hint

    Broad instrumentation has a cost.