How to override include_once pointed file using add_filter?

You can’t just filter __FILE__. Or any arbitrary function or variable. You can only filter values that are passed to apply_filters(). In this case the wcpv_vendor_order_page_template filterable value is: dirname( __FILE__ ) . ‘/views/html-vendor-order-page.php’ In other words, it’s a path to a PHP file. If you want to change the PHP file that’s loaded, you … Read more

Adding JavaScript file in Admin Panel

Yes, your code is good. And that my_custom_script is a unique identifier for the script you’re enqueueing. You can find the default script handlers/identifiers here — e.g. jquery for the jQuery library that ships with WordPress. There you can also find more details about the wp_enqueue_script() function, e.g. where should you use the function, the … Read more

hooks for automatic approve user registration according to data in custom fields

## Try this if you are using Woocommerce function ws_new_user_approve_registration_message(){ $not_approved_message=”<p class=”registration”>Send in your registration application today!<br /> NOTE: Your account will be held for moderation and you will be unable to login until it is approved.</p>”; if( isset($_REQUEST[‘approved’]) ){ $approved = $_REQUEST[‘approved’]; if ($approved == ‘false’) echo ‘<p class=”registration successful”>Registration successful! You will be … Read more

How to use pre_get_posts

pre_get_posts happens just before a WP_Query needs to go to the database to grab stuff. Since every page has a main query, that can be changed. Does it go in the search template? No! By the time templates are loaded, the main query has already decided what to grab and gone to the database. Newcomers … Read more