Skip to content

Tag: wordpress

Serving a page to any URL that ends in its slug

Still new to WordPress, so please go easy on me. Goal: Prevent users of a specific role from viewing other custom post types made by users of same role. Intended solution: Modify the URL and redirect to a custom 403 page when the user ID doesn’t match the post author. As such, if the person attempting t…

ACF & WordPress Media Library

I’ve got an ACF ‘options page’ with a placeholder image within, to fall back to if a client removes the image from the post/page by mistake. And I’m using the following code to handle this situation happening. This works fine once pages or posts are saved. However The issue I have is i…

How to fetch values for every id present in array using loop

I have an array with following values: and a table ‘orderdetails’ in database with order_title and order_id columns. What I want is to fetch order_title of every order using order_id in a loop. Can anyone help? What I know is: but this will make query run multiple times, any better solution? UPDAT…