0

I am trying to create a custom post type called DondeAmigo that accepts hierarchical pages. Example: I create a page called 'lewis', whose URL becomes: /donde-amigo/lewis. Then, I create a page called 'home' that I want it to be under 'lewis'. The idea would be for the URL to be /donde-amigo/lewis/home .

I set hierarchical to true and I added 'page-attributes' inside 'supports'. But still, when I edit the new page, I do not see the 'Add parent page' option.

//WHERE IS OUR FRIEND?
    $labels = array(
    'name' => _x( 'DondeAmigo', 'post type general name' ),
        'singular_name' => _x( 'dondeamigo', 'post type singular name' ),
        'add_new' => _x( 'Añadir nueva', 'book' ),
        'add_new_item' => __( 'Añadir nueva página' ),
        'edit_item' => __( 'Editar página' ),
        'new_item' => __( 'Nueva página' ),
        'view_item' => __( 'Ver página' ),
        'search_items' => __( 'Buscar página' ),
        'not_found' =>  __( 'No se han encontrado página' ),
        'not_found_in_trash' => __( 'No se han encontrado páginas en la papelera' ),
        
        'parent_item_colon' => ''
    );
 
    // Creamos un array para $args
    $args = array( 'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'taxonomies' => array('dondeamigo'),
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => true,
        'menu_position' => null,
        'show_in_rest' => true,
        'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields','page-attributes')
    );
    
    register_post_type( 'donde-amigo', $args );

In the right side of the Wordpress page, under Page attributes, I only see the template and order settings, not the parent page one.

3
  • Are there more than 1 pages - you can't have a parent until you have 2 pages? also, did you try 'capability_type' => 'page',
    – Q Studio
    Jan 9, 2021 at 12:29
  • Yes, I already have 4 pages created, but when adding a new one, no option for it being the child of one of the others.
    – Luis Galdo
    Jan 9, 2021 at 13:00
  • Also, I tried 'capability_type' => 'page' and nothing
    – Luis Galdo
    Jan 9, 2021 at 13:02

1 Answer 1

0

I discovered that if you press fast_edit before editing the page, there is an option to choose the superior page. While if you access edit this option is not present.

The reason might be a collision between plugins or between a plugin and WordPress.

2
  • This will not be a WP error, there will be something specific about your set-up, a plugin or theme perhaps - which is manipulating the single post edit view - you need to disable everything possible to locate what.
    – Q Studio
    Jan 10, 2021 at 17:47
  • You are right, probably is some kind of issue of two plugins colliding. It is just strange that in the fast edit everything works fine while in the other it does not. I will update the answer to remove the last sentence.
    – Luis Galdo
    Jan 10, 2021 at 20:24

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.