admin管理员组

文章数量:1420197

I have a custom plugin that is integrated with woocommerce. I want to display listing records in the user's profile and have successfully done so. Creating the end points. refreshing the permalinks. Yet, the call back to drawing the content within the endpoint tab does not appear. Only the dashboard.

 function mylistings_account_menu_items( $items ) 
   {
    $items['mylistings'] = __( 'Active Listings', 'mylistings' );
    return $items;
   }
 add_filter( 'woocommerce_account_menu_items', 'mylistings_account_menu_items', 10, 1 );

  function mylisting_add_my_account_endpoint() 
   {
    add_rewrite_endpoint( 'mylistings', EP_PAGES ); 
    }
 add_action( 'init', 'mylisting_add_my_account_endpoint' );


 // THIS DOES NOT APPEAR TO BE WORKING WHY?

 function mylistings_information_endpoint_content() 
   {
    echo 'THIS IS A TEST OF THE CONTENT';
   }
  add_action( 'woocommerce_account_information_endpoint', 'mylistings_information_endpoint_content' );

What am I missing?

I have a custom plugin that is integrated with woocommerce. I want to display listing records in the user's profile and have successfully done so. Creating the end points. refreshing the permalinks. Yet, the call back to drawing the content within the endpoint tab does not appear. Only the dashboard.

 function mylistings_account_menu_items( $items ) 
   {
    $items['mylistings'] = __( 'Active Listings', 'mylistings' );
    return $items;
   }
 add_filter( 'woocommerce_account_menu_items', 'mylistings_account_menu_items', 10, 1 );

  function mylisting_add_my_account_endpoint() 
   {
    add_rewrite_endpoint( 'mylistings', EP_PAGES ); 
    }
 add_action( 'init', 'mylisting_add_my_account_endpoint' );


 // THIS DOES NOT APPEAR TO BE WORKING WHY?

 function mylistings_information_endpoint_content() 
   {
    echo 'THIS IS A TEST OF THE CONTENT';
   }
  add_action( 'woocommerce_account_information_endpoint', 'mylistings_information_endpoint_content' );

What am I missing?

Share Improve this question edited Jul 13, 2019 at 9:34 nmr 4,5672 gold badges17 silver badges25 bronze badges asked Jul 13, 2019 at 2:19 Debbie KurthDebbie Kurth 4323 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Dang it...must be blind....FOUND IT. The solution is, that since this is a custom hook, and most likely using JQuery, you place the end point action within the call.

Instead of this:

  function mylistings_information_endpoint_content() 
    {
     echo 'THIS IS A TEST OF THE CONTENT';
    }
   add_action( 'woocommerce_account_information_endpoint', 'mylistings_information_endpoint_content' );

It is this:

  function **mylistings**_information_endpoint_content() 
    {
     echo 'THIS IS A TEST OF THE CONTENT';
    }
   add_action( 'woocommerce_account_**mylistings**_endpoint', 'mylistings_information_endpoint_content' );

本文标签: plugin developmentWooCommerce Endpoints content