Online Store Kit Online Store Kit

Developer API

Hooks, filters and data shapes for extending WP MyLinks.

The hooks and data shapes below are public API in WP MyLinks 1.1.0 and later: they follow semantic versioning and will not break within a major version. Anything not listed here is internal and may change without notice.

Template actions

Each fires in the standalone bio-page template and receives the current MyLink post ID.

Hook Where it fires
wp_mylinks_head Inside <head>, after the plugin’s own assets and user scripts
wp_mylinks_body_open Immediately after <body>
wp_mylinks_before_links Before the links list
wp_mylinks_after_links After the links list, inside the main element
wp_mylinks_footer Inside the footer, before its closing tag

Rendering filters

  • wp_mylinks_link_data( array $link, int $post_id, int $link_index ) — filters one link row’s data before it renders. Return an empty value to skip the link entirely (scheduling, targeting, A/B).
  • wp_mylinks_link_render( string $item_html, array $link, int $post_id, int $link_index ) — filters one rendered link item’s escaped HTML. Return an empty string to drop the item.
  • wp_mylinks_schema_data( array $data, int $post_id ) — the Schema.org array before JSON encoding.
  • wp_mylinks_og_meta( array $og_lines, int $post_id ) — the pre-escaped Open Graph and Twitter Card meta lines.
  • wp_mylinks_cpt_rewrite_slug( string $slug ) — the internal rewrite slug (default mylink). Public URLs are slug-stripped either way.
  • wpmylinks_url_params( array $params, string $base_url ) — campaign parameters appended to the plugin’s own outbound links.

Admin extension surface

  • wp_mylinks_meta_boxes( array $boxes ) — the registered metabox definitions, keyed by box id. Add, remove or amend boxes here.
  • wp_mylinks_field_types( array $map ) — the field-type string to class map. Built-in types include text, text_url, textarea_small, select, radio, radio_inline, wysiwyg, file, oembed, group, pw_select and colorpicker. Classes must extend Wp_Mylinks_Field.
  • wp_mylinks_settings_tabs( array $tabs ) — the settings-page tabs, keyed by tab slug. Each entry is array( 'dashicon-slug', 'Label', $render_callable ).

Analytics

The action wp_mylinks_track_link_click( int $post_id, string $url, string $hash, int $count ) fires after a link click is recorded by the built-in counter.

Meta key Shape
wp_mylinks_count_visits Integer page views, incremented per non-bot render.
wp_mylinks_link_clicks An array of md5( link URL ) to integer count. wp_mylinks_get_link_clicks_total( $post_id ) sums it.
// Drop any link pointing at example.com before it renders.
add_filter( 'wp_mylinks_link_data', function ( $link, $post_id, $index ) {
    if ( ! empty( $link['url'] ) && false !== strpos( $link['url'], 'example.com' ) ) {
        return ''; // returning empty skips this row
    }
    return $link;
}, 10, 3 );

Last modified August 19, 2026

Was this page helpful?
Online Store Kit

Ready to Get Started?

Grab the kit, install in minutes, and start selling everywhere your customers already shop.

Cookies keep the cart rolling

We use cookies for your cart, login session, and secure checkout. Details in the privacy policy.