Quantcast
Channel: metabox – Bill Erickson
Viewing all articles
Browse latest Browse all 7

Use Page Links To with custom metabox

$
0
0

The Page Links To plugin is a great tool for setting the post permalink to an external URL. This way, when the post shows up in archive pages and search results, clicking it goes to that external URL.

You might want to use this feature in a custom metabox with your other metdata, rather than using a separate metabox.

In the code below, the first function removes the Page Links To metabox. The second creates a new metabox using CMB2 containing the URL field. The third function sets the “open in new window” checkbox to true on all posts. If you want this to be optional, remove this third function and add a field to your metabox with a key of _links_to_target.

View this code snippet on GitHub.

The post Use Page Links To with custom metabox appeared first on Bill Erickson.


Viewing all articles
Browse latest Browse all 7

Trending Articles