0

Is it possible/how do I to attach a page to a category similar to how we attach media to a post?

ps. I'm not asking how to assign a category to a page.

update: I need to attach a specific page contents on top of the archive of a specific category archive.

8
  • Using ACF and a relationship field is the first thing that comes to mind, if you don't use acf you could use update_term_meta and add a page id. Commented Dec 6, 2021 at 15:25
  • @Buttered_Toast Thanks for this. Could you give me more details (aka an example maybe ) of how to do this with ACF?
    – Pete
    Commented Dec 6, 2021 at 15:33
  • I want to use this to display a page's content on category archive.
    – Pete
    Commented Dec 6, 2021 at 15:34
  • 1
    @TomJNowell Yes please... that's what i'm trying to do.
    – Pete
    Commented Dec 8, 2021 at 11:28
  • 1
    @TomJNowell "are you trying to display a pages content at the top of a category?" Yes, exactly
    – Pete
    Commented Dec 8, 2021 at 12:51

1 Answer 1

1

No, media is attached to posts/pages using the post_parent column. This works because media is actually a post of type attachment in the database.

Categories however are not posts, and the way you would attach them is by assigning the page to that category.

This leads us to a contradiction, how do you attach a page to a category without attaching it to a category?

I'm sure that your original problem is solvable but this is not the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.