• In a plugin amb trying to use this filter: wp_before_load_template; I use it like

    add_action(‘wp_before_load_template’,’my_function_before_load_template’, 20, 3);

    But I can not get any log neither in the Site Editor or in the front end.

    I am using a block theme (Twenty Three) and WP 6.3.1 on a local host.

    What I am doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    That action only fires when PHP templates are loaded for a classic theme. It’s not used with block themes like 2023. Block theme templates are loaded through a different mechanism. That’s all I know. IDK what that mechanism might be, sorry.

    What are you actually trying to do with that action hook? Maybe someone else can suggest an approach compatible with block themes.

    Thread Starter capbussat

    (@capbussat)

    Thanks, I am trying to get the information about which template is loaded for a page/post in a block theme.

    I think I will look into template.php, template-loader.php and post-template.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_before_load_template’ is closed to new replies.