I am trying this code snippet and it is working fine for me, additionally there wasn’t any changes in WPAdverts which would break it.
Thread Starter
lazyym
(@lazyym)
This is the code from that link.
action( "init", "my_contact_form_init", 1000 );
function my_contact_form_init() {
if( ! is_user_logged_in() ) {
remove_all_actions( "adverts_tpl_single_bottom" );
add_action( "adverts_tpl_single_bottom", "anon_message" );
}
}
function anon_message() {
echo "Login to contact the seller";
}
I notice other functions have add_action, not just action like the code. When I replace it with add_action, it now works. 🙂
The complete function that now works for me is
add_action( "init", "my_contact_form_init", 1000 );
function my_contact_form_init() {
if( ! is_user_logged_in() ) {
remove_all_actions( "adverts_tpl_single_bottom" );
add_action( "adverts_tpl_single_bottom", "anon_message" );
}
}
function anon_message() {
echo "Login to contact the seller";
}