OG Account Customiser: developer's guide¶
This page lists what OG Account Customiser and OG Account Customiser Lite expose to code: the PHP API, actions, filters, shortcodes, REST routes, AJAX actions, templates, options, meta and constants. For settings and everyday use, see the user guide.
Items marked Pro exist only in OG Account Customiser. Wishlist items also need an active Pro licence and the wishlist switched on.
There are no blocks, no MCP tools, no WP-CLI commands and no custom database tables.
PHP API¶
Both editions define the same functions, so code that adds tabs works with either. Always guard calls with function_exists().
| Function | Returns | What it does |
|---|---|---|
og_account_register_tab( $id, $args ) |
bool |
Adds a tab to the My Account menu. Returns false (with a _doing_it_wrong notice) for a bad id, a WooCommerce core id or a callback that is not callable. |
og_account_unregister_tab( $id ) |
void | Removes a tab you registered. |
og_account_get_tabs() |
array[] |
The menu as the current user sees it, in order. Groups carry children. Only meaningful on the front end after wp. |
og_account_tab_url( $id ) |
string |
The URL of a tab. Link tabs return their target. |
og_account_customiser_version() |
string |
The running version, for feature checks. |
og_account_register_tab() arguments¶
| Key | Type | Default | Meaning |
|---|---|---|---|
label |
string | the id | Menu label. Translate it in your own text domain. |
title |
string | the label | Page heading. |
callback |
callable | none | Prints the tab's content. When given, the plugin registers the endpoint for you. |
endpoint |
bool | true with a callback |
Force endpoint registration on or off. Leave the callback out and set false if your plugin registers the endpoint and hooks woocommerce_account_<id>_endpoint itself. |
icon |
string | guessed | A built-in icon name, a Font Awesome class (contains fa-), or an image URL (Pro shows image icons). |
position |
string | before Log out | before:<id>, after:<id>, start or end. Only where it first appears. |
roles |
string[] | everyone | Pro. Only show to these roles. |
group |
string | none | Pro. Id of a group tab to sit inside. |
enabled |
bool | true |
Shown by default. |
The id becomes the address (/my-account/<id>/). Use letters, digits, dashes and underscores only. The shop owner can still rename, move, hide or restrict the tab in the editor, and their choices win.
add_action( 'og_account_customiser_register_tabs', function () {
if ( ! function_exists( 'og_account_register_tab' ) ) {
return;
}
og_account_register_tab( 'my-licences', array(
'label' => __( 'Licences', 'my-plugin' ),
'icon' => 'key',
'position' => 'after:downloads',
'callback' => 'my_plugin_render_licences',
) );
} );
Built-in icon names: home, user, shield, download, receipt, edit, pin, card, logout, heart, wallet, star, gift, wheel, key, puzzle, box, sync, bell, settings, link, file, chat, help, folder, badge, dot. Common Font Awesome names (for example user-circle or credit-card) map to the closest built-in icon.
Actions¶
| Action | Arguments | When it fires | Edition |
|---|---|---|---|
og_account_customiser_register_tabs |
none | On init, priority 5. Register your tabs here. |
Both |
og_account_customiser_security_sections |
int $user_id |
On the Security tab, below the password form. Print a complete section with its own form. | Pro |
og_account_customiser_password_changed |
int $user_id |
After a customer changed their password on the Security tab. | Pro |
og_wishlist_item_added |
int $product_id, int $user_id |
After a product is added through the REST route. $user_id is 0 for guests. |
Pro |
og_wishlist_item_removed |
int $product_id, int $user_id |
After a product is removed through the REST route. | Pro |
og_wishlist_merged |
int $user_id, array $guest, array $account |
After a guest list is merged into an account at sign-in. Lists map product id to the time it was added. | Pro |
// Add a two-factor box to the Security tab.
add_action( 'og_account_customiser_security_sections', function ( $user_id ) {
echo '<section class="my-2fa"><h3>Two-factor sign-in</h3>...</section>';
} );
Filters¶
| Filter | Arguments | Default | What it changes | Edition |
|---|---|---|---|---|
og_account_customiser_menu_items |
array $menu, array $items |
arranged menu | The final menu (id => label) after the plugin arranged it. $items is the menu as it arrived. |
Both |
og_account_customiser_avatar_max_bytes |
int $bytes |
2097152 (2 MB) |
Largest profile picture upload. | Pro |
og_wishlist_show_on_loop |
bool $show |
the setting | Hearts on shop and category cards. | Pro |
og_wishlist_show_on_single |
bool $show |
the setting | Heart on product pages. | Pro |
og_wishlist_max_items |
int $max |
the setting (100) | Most items on one list. | Pro |
og_wishlist_show_button |
bool $show, WC_Product $product, string $context |
true |
Hide the heart for one product. $context is loop, single, block or shortcode. |
Pro |
og_wishlist_button_html |
string $html, WC_Product $product, string $context |
button HTML | The heart button markup. | Pro |
og_wishlist_is_listable_product |
bool $ok, WC_Product $product |
true for a published, visible product (never a variation) |
Whether a product may go on a wishlist. | Pro |
og_wishlist_enqueue_everywhere |
bool $all |
true |
Load the wishlist CSS and JS on every front-end page. Return false to load them only where needed. |
Pro |
og_wishlist_account_endpoint |
string $slug |
account-wishlists |
The My Account endpoint for the Wishlist tab. | Pro |
og_wishlist_guest_base |
string $base |
wishlist |
The guest wishlist address (/wishlist/). |
Pro |
og_wishlist_share_base |
string $base |
shared-wishlist |
The share link base (/shared-wishlist/<token>/). |
Pro |
og_wishlist_guest_cookie_days |
int $days |
30 |
How long the guest cookie lasts. | Pro |
og_wishlist_remove_after_add_to_cart |
bool $remove, int $product_id |
true |
Remove an item from the list when it is moved to the basket. | Pro |
The plugin hooks its own wishlist settings into og_wishlist_show_on_loop, og_wishlist_show_on_single and og_wishlist_max_items at priority 5, so your filter at the default priority 10 wins.
// Keep items on the list after they go to the basket.
add_filter( 'og_wishlist_remove_after_add_to_cart', '__return_false' );
// No heart on gift cards.
add_filter( 'og_wishlist_show_button', function ( $show, $product ) {
return $product->get_type() === 'gift-card' ? false : $show;
}, 10, 2 );
After changing an address filter (og_wishlist_account_endpoint, og_wishlist_guest_base, og_wishlist_share_base), go to Settings › Permalinks and click Save to rebuild the rewrite rules.
Shortcodes (Pro)¶
| Shortcode | Attributes | Output |
|---|---|---|
[og_wishlist] |
none | The current visitor's wishlist, with move to basket and remove. |
[og_wishlist_button] |
id (product ID; default the current product) |
A heart button for that product. |
[og_wishlist_link] |
none | A link to the wishlist with a live count (.og-wl-link, .og-wl-count). |
REST routes (Pro)¶
Namespace og-wishlist/v1. The routes work for signed-in customers and guests (guests use the signed cookie). Every response has no-cache headers and a fresh wp_rest nonce. Send the nonce in the X-WP-Nonce header for signed-in users.
| Method | Route | What it does |
|---|---|---|
GET |
/wp-json/og-wishlist/v1/items |
The current list. |
POST |
/wp-json/og-wishlist/v1/items/<id> |
Add product <id>. Error og_wishlist_bad_product (400) or og_wishlist_full (409). |
DELETE |
/wp-json/og-wishlist/v1/items/<id> |
Remove product <id>. |
Response:
items are product IDs, newest first.
AJAX actions (Pro)¶
| Action | Who | What it returns |
|---|---|---|
og_wishlist_nonce |
signed-in and guests | { "success": true, "data": { "nonce": "..." } }, a fresh REST nonce for pages served from cache. |
Admin-post actions¶
| Action | Capability | Nonce | What it does | Edition |
|---|---|---|---|---|
ogac_save |
manage_woocommerce |
ogac_save |
Saves the tab layout and settings. | Both |
ogac_reset |
manage_woocommerce |
ogac_reset |
Deletes the saved layout. | Both |
ogac_import |
manage_woocommerce |
ogac_import |
Imports a My Account layout saved by another My Account tabs plugin. | Pro |
ogac_licence_activate |
manage_woocommerce |
ogac_licence |
Activates the key posted as ogac_licence_key. |
Pro |
ogac_licence_deactivate |
manage_woocommerce |
ogac_licence |
Releases this site's activation. | Pro |
Templates¶
| Template | Override in your theme | Edition |
|---|---|---|
| My Account menu | yourtheme/og-account-customiser/navigation.php |
Both |
| Wishlist list | yourtheme/og-wishlist/wishlist.php |
Pro |
| Guest wishlist page | yourtheme/og-wishlist/guest-wishlist.php |
Pro |
| Shared wishlist page | yourtheme/og-wishlist/shared-wishlist.php |
Pro |
The menu template is used only while Use the OG menu design is on. It still fires woocommerce_before_account_navigation and woocommerce_after_account_navigation.
Admin screen¶
| Item | Value |
|---|---|
| Menu slug | og-account-customiser (top-level, manage_woocommerce) |
| Open a section | admin.php?page=og-account-customiser&ogac_tab=<section> |
| Sections (Pro) | tabs, settings, wishlist, tools, licence |
| Sections (Lite) | tabs, settings, tools, pro |
Options¶
Both editions use the same options, so a layout carries over between them.
| Option | What it holds |
|---|---|
og_account_customiser |
The layout and settings: schema_version, tabs (ordered list), settings, imported_at. Not autoloaded. |
og_account_customiser_seen |
Menu items seen on the front end (id => label), so the editor can list tabs other plugins add only there. |
og_account_customiser_flush |
1 when rewrite rules must be rebuilt on the next request. |
og_account_customiser_endpoints |
A hash of the endpoints the plugin registers, to detect changes. |
og_wishlist_version |
Pro. Wishlist data version. |
og_wishlist_flush_rewrites |
Pro. Flag to rebuild wishlist rewrite rules. |
ogk_client_og_account_customiser |
Pro. Licence state. Not autoloaded. |
settings keys¶
| Key | Type | Default | Edition |
|---|---|---|---|
default_tab |
string | dashboard |
Both |
use_template |
bool | true |
Both |
show_icons |
bool | true |
Both |
layout |
string | side (side or top) |
Both |
style |
string | og (og or neutral) |
Both |
accent |
string | empty (hex #rrggbb) |
Both |
delete_on_uninstall |
bool | false |
Both |
avatar_upload |
bool | false |
Pro |
security_tab |
bool | false |
Pro |
wishlist |
bool | true |
Pro |
wishlist_loop |
bool | true |
Pro |
wishlist_single |
bool | true |
Pro |
wishlist_max_items |
int | 100 (1 to 500) |
Pro |
Tab fields¶
Each entry in tabs has: id, type (endpoint, content, link or group), source (woocommerce, plugin, api or custom), label, enabled, icon_type (builtin, fontawesome, image or none), icon, icon_image, roles, parent, content, content_position (before or after), url, new_tab, banner_image, banner_link, banner_alt, banner_position (top or bottom) and classes.
User meta and post meta (Pro)¶
| Key | Where | What it holds |
|---|---|---|
ogac_avatar_id |
user meta | Attachment ID of the customer's profile picture. |
_ogac_avatar_user |
post meta on the attachment | The user ID that owns the picture. |
_og_wishlist_items |
user meta | The customer's wishlist (product ID => time added). |
_og_wishlist_share |
user meta | The share token (32 hex characters) while sharing is on. |
The profile picture is a normal media attachment. It replaces the Gravatar through pre_get_avatar_data.
Cookies (Pro)¶
| Cookie | What it holds | Lifetime |
|---|---|---|
og_wishlist |
A guest's wishlist, signed with a key derived from the site's salts. HttpOnly, SameSite Lax. | 30 days (filter og_wishlist_guest_cookie_days) |
Constants¶
| Constant | Where | What it does | Edition |
|---|---|---|---|
OGAC_VERSION, OGAC_FILE, OGAC_DIR, OGAC_URL |
set by the plugin | Version, main file, folder path and URL. If OGAC_VERSION is already defined, a second copy shows a notice and does nothing. |
Pro |
OGACL_VERSION, OGACL_FILE, OGACL_DIR, OGACL_URL |
set by the plugin | The same for Lite. | Lite |
OG_WISHLIST_VERSION, OG_WISHLIST_FILE, OG_WISHLIST_DIR, OG_WISHLIST_URL |
set by the plugin | Defined while the built-in wishlist runs. | Pro |
OG_WISHLIST_KEEP_DATA |
wp-config.php |
true keeps saved wishlists when you delete the separate OG Wishlist plugin. |
Pro |
Lite rests when OGAC_VERSION is defined, so you can test defined( 'OGAC_VERSION' ) to know the Pro plugin is running.
Markup and CSS¶
| Item | Meaning |
|---|---|
body.ogac-account |
On My Account pages the plugin arranges. |
body.ogac-layout-side, body.ogac-layout-top |
Menu position. |
body.ogac-style-og, body.ogac-style-neutral |
The chosen look. |
.ogac-nav |
The menu. Its --ogac-accent custom property holds the accent colour. |
.ogac-tab, .ogac-tab--<type> |
Each menu item, with its tab type. |
.ogac-content |
Custom page content. Pro. |
.ogac-extra--before, .ogac-extra--after |
Extra content on an existing page. Pro. |
.ogac-banner--top, .ogac-banner--bottom |
Tab banners. Pro. |
.og-wl-* |
Wishlist buttons, lists and links. Pro. |
JavaScript¶
| Global | Where | Contents |
|---|---|---|
ogacEditor |
the settings screen | Tabs, icons, roles, unlocked features and labels for the tab editor. |
ogWishlist |
the front end (Pro) | rest (items route URL), ajax, nonce, listUrl and i18n strings. |
The wishlist script fires no custom events. Buttons and counts are filled in after page load, so cached pages stay correct.
Uninstall¶
uninstall.php deletes the four og_account_customiser* options only when delete_on_uninstall is on. Lite skips this while the Pro plugin folder exists. Wishlists, profile pictures and their meta are never removed.