0

I'm in index.php and I'm trying to create a list of links to the archive pages for three custom post types I've registered. Here's what I have so far:

// Get custom post types, excluding Wordpress' built-in ones

$cpts = get_post_types( array(
    '_builtin' => false
));

// Get a name and a link to the archive page of each custom post type

foreach( $cpts as $cpt ) {
    $name = get_post_type_object( $cpt )->labels->name; 
    $link = get_post_type_archive_link( $cpt );
    echo "<a href=$link>$name</a>";
}       

The code works well except that, in addition to the three custom post types I've registered, a fourth one comes up whose $name is Logs and the $link is my site's homepage url.

What is this 'Log' post type? Is it Wordpress' default Post? Shouldn't the _builtin => fakse parameter for get_post_types exclude it already? If not, how do I exclude it?

1
  • 1
    This doesn't look like a core WordPress type. This must come from a plugin.
    – mmm
    Nov 11 '17 at 10:11
0

Like mmm suggested in the comments, 'Logs' is a custom post type created by a plugin I'm using, which means that the correct answer is there is no default Wordpress' custom post type. I hope it's clearer now.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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