query – Change the destination of the URLs in post.php

Question

The post.php screen lists posts vertically in the admin area [and other post types]. Each item’s post_title is a hyperlink, directly above some inline choices. Both the title link, and the “Edit” inline selection, redundantly go to the same destination, namely:

http[s]://{yoursite.tld}/wp-admin/post.php?post={postID}&action=edit

enter image description here

I want to filter the post_title URL href using PHP. Specifically, I want to set a custom destination to the URL, based on metadata stored in the post.
i.e post_ID:123 has post meta data:

{'custom_URL' : 'http:somesite.com'}

In post.php, how can I change the post_title hyperlink href destination URL, to a custom destination – preferably with PHP?

I’ll need to somehow intercept the main query loop within post.php, because I need to do a metadata query for each of the displayed items, based on their postID. Which could be 1-200 things, generally. I could use JS to fetch the post IDs, and then do an API call(s) to the server from the browser, but I’d rather filter it from PHP before it’s emitted.

0
John Dee 7 days 2022-05-12T21:24:03-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse