WordPress Codesnippets

woocommerce wc_get_endpoint_url add


This code adds a filter to the WooCommerce endpoint URL, which allows the URL to be modified when the “add” endpoint is specified. The filter calls the my_custom_endpoint_url() function, which checks the endpoint and sets the URL to the home page, with the “add” endpoint appended to it. This allows for a custom URL to be used when accessing the “add” endpoint.

Was this code snippet helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmatically save post

This code creates a WordPress post with the values of the ‘post_title’ and ‘post_content’ variables. It sets the post status to ‘publish’ and the author

Read More »

Create order programmatically

This code creates a new post in the WordPress database with post type ‘shop_order’, post title ‘Order #12345’, post status ‘wc-processing’, and ping status ‘closed’.

Read More »