Filters

  • lh_page_links_to_get_applicable_post_types: array of post types the link panel, redirect and sitemap exclusions apply to. Default array( 'post', 'page' ).
  • lh_page_links_to_is_valid_link_url: ( bool $valid, string $url ). Whether a value counts as a valid link. The default accepts full http or https URLs with a host. It is used both when saving and when reading, so a stricter or looser rule applies to both.
  • lh_page_links_to_return_link_meta_key: the post meta key the link is stored under. Default _lh_page_links_to-link_url. The block editor panel is given the filtered key.
  • lh_page_links_to_init_plugin: return false to stop the plugin adding any of its hooks.

Actions

  • lh_page_links_to_redirect_url: ( int $post_id, string $url ). Fires just before a visitor is redirected, for example to log redirects.

Integrations

  • wp_sitemaps_posts_query_args: posts with a valid link are left out of the core XML sitemap.
  • lh_html_sitemap_get_excluded_post_ids: posts with a valid link are left out of the LH HTML Sitemap.

Data

The link is stored in a single post meta value, _lh_page_links_to-link_url, registered with show_in_rest so the block editor can read and write it. Only valid links are stored: an empty or invalid value deletes the meta instead. Editing it requires permission to edit that post. There are no custom tables, options or cron jobs.

Public method

LH_Page_links_to_plugin::get_link( $post ) takes a post or post ID and returns its link URL, or false if it has no valid link. Use it in a theme to link a post title straight to its destination.