Divi hook not working [closed]

I hope you’re doing well! I wonder if adding a priority to your filter would fix the issue. In the past I’ve had filters not fire because the default priority was too high or low. Could you try something like this: add_action( ‘et_after_main_content’, ‘bgt_add_conditional_code_to_event_pages’, 9999 ); And see if that resolves the issue? From what … Read more

Utilising an existing page while using the “s” query parameter

Custom Query Var Moving s to a custom query variable when a page is explicitly requested should be simple enough: function wpse390935_set_page_search_qv( $wp ) { $qvs = $wp->query_vars; if( empty( $qvs[‘s’] ) || ( empty( $qvs[‘pagename’] ) && empty( $qvs[‘page_id’] ) ) ) return; $wp->query_vars[‘page_search’] = $qvs[‘s’]; unset( $wp->query_vars[‘s’] ); } add_action( ‘parse_query’, ‘wpse390935_set_page_search_qv’ ); … Read more

Force file download in WordPress

You get the error because WordPress attempted to parse the request which means WordPress tries to find a resource such as a post or category archive which matches the request URL (/download.php), and when not found, WordPress sets the HTTP status header to 404 Not Found. So to fix the issue, you could use parse_request … Read more

Function not working inside of a function in functions.php

Remove the function inside the function, and instead call the wp_register_script and register_block_type inside the large function. Finally, remove the inner add_action() call, so you only have the ending one for the large function. function irm_lockdown_author_role() { if (isset($userrole->roles[0])) { $current_role = $userrole->roles[0]; } else { $current_role=”no_role”; } if (‘author’ == $current_role) { /* function … Read more

Why does the post_type_link hook everything twice?

When you add a filter to post_type_link, you are telling WordPress to run the hooked function on the result of the get_post_permalink() function. So any time that function runs, so does yours. When I tested the filter myself, I only saw a printed message once for each link, but if you have something like this: … Read more