permalinks – How to keep WP from creating a “single-post” page and let the user input the link of the post in the dashboard?

Question

I have this very specific questions. On my homepage I decided to show excerpts of the latest news and events with a “while” loop.
The issue is that I want the admin to define what the permalink will be of said post, and not have a /event/lorem-ipsum page for each event. The idea is to link those excerpts to Instagram posts, Facebook posts, or whatever…

My custom_post_type function is:

register_post_type('event', 
    array(
        'rewrite' => array('slug' => 'events'),
        'labels' => array(
            'name' => 'Events',
            'singular_name' => 'Event',
            'adding_new_item' => 'Add event',
            'edit_item' => 'Edit event'
        ),
        'menu-icon' => 'dashicons-calendar-alt',
        'public' => true,
        'has_archive' => true,
        'supports' => array(
            'title', 'thumbnail', 'editor', 
        )
    )
);

0
mkhvn 1 month 2021-06-12T20:59:33-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse