Add sub subpage endpoint in woocommerce

Thanks to @mmm and his comment defining $endpointsub before $endpoint it worked. Not sure why that is but that solved it. So change the order of endpoints: $endpointsub = ‘my-new-endpoint/new-subendpoint’; $endpoint=”my-new-endpoint”; add_rewrite_endpoint( self::$endpointsub, EP_ROOT | EP_PAGES ); add_rewrite_endpoint( self::$endpoint, EP_ROOT | EP_PAGES ); add_query_vars( $vars ) { $vars[] = self::$endpointsub; $vars[] = self::$endpoint; return $vars; … Read more

WordPress custom slug (endpoint) and compare all links

All of the API functions that generate links have filters to let you alter the output. Here’s a quick example that covers most of them: function wpd_endpoint_links( $url ){ if( isset( $_COOKIE[‘lang’] ) ){ $url = $url . $_COOKIE[‘lang’] . “https://wordpress.stackexchange.com/”; } return $url; } add_filter( ‘post_link’, ‘wpd_endpoint_links’ ); add_filter( ‘page_link’, ‘wpd_endpoint_links’ ); add_filter( ‘post_type_link’, … Read more

POST request not going through?

I found that it didn’t work because both endpoints used the same route. I expected defining one for POST and one for GET would result in different callbacks, but they apparently conflict with each other. In a first time, I get the request going through simply by change the namespace for the POST. Maybe there … Read more

Is there anyway to format my EndPoint URL in WordPress?

You don’t. Query args are not part of the route URL. Your endpoint URL is: https://iotkidsiq.com/wp-json/zaindob/v1/sync_order So needs to be registered as: register_rest_route( ‘zaindob/v1’, ‘/sync_order’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘updatetable’, ) ); key and msisdn are arguments that are sent to your endpoint. To define these use set the args property of the … Read more

Add Rewrite Endpoint to CPT Archive

You’re getting the 404 most likely because your custom taxonomy is not assigned to the endpoint mask (EP_PAGES) used with your endpoint. Because add_rewrite_endpoint() does work with custom post types and taxonomies, but you need to assign the endpoint mask to the post type or taxonomy during registration, via the ep_mask key in the rewrite … Read more

WP Rest endpoint with custom post type and ACF Fields

Advanced custom fields uses get_field() function to retrieve the fields. So, all you have to do is to retrieve them by using: $field = get_field(‘field_name’, $post->ID, ‘format_value’); for each of your fields in the loop. You can read this page for more information. Questions about plugins are off-topic here, That’s why your question haven’t receive … Read more

Associate the “add_rewrite_endpoint” and “$_GET”

Query parameters added using add_rewrite_endpoint() are available using get_query_var(). So if you register /en/ as an endpoint: function wpse_318560_en_endpoint(){ add_rewrite_endpoint(‘en’, EP_ALL); } add_action(‘init’, ‘wpse_318560_en_endpoint’ ); And don’t flush rewrite rules on init. Rewrite rules only need to be flushed once. See this note in the developer docs for a way to properly flush rewrite rules … Read more

Create multiple rewrite endpoints for custom taxonomy archive

This code above works fine up to one endpoint but not working for multiple endpoints like following https://example.com/dogs/shop/prod-cat1 https://example.com/dogs/shop/prod-cat2 https://example.com/cats/shop/prod-cat1 https://example.com/cats/shop/prod-cat2 Uses template shop-cat.php & value of query variable i.e prod-cat1, prod-cat2 available on template Your request hook callback is always setting the query var to true, like so (for the shop var): if (isset($vars[‘shop’])) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)