Found a solution for opening in a new tab…
-
I saw a lot of unresolved posts for the links not opening in a new tab, and I found a solution that could work for others that I wanted to share…
The Page Links To data is stored in the post meta, so I retrieved it like so:
$post_meta = get_post_meta($post_id); // gets the post meta for the post $redirect_url = $post_meta['_links_to'][0]; // the custom URL that you set for the post $target = $post_meta['_links_to_target'][0]; // the target – _self, _blank, etc.
After that, I just use the
$redirect_url
and$target
variables to build my link.
- The topic ‘Found a solution for opening in a new tab…’ is closed to new replies.