Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:39:34+00:00 2026-06-17T14:39:34+00:00

I have a array of posts and i displayed it like bellow $types =

  • 0

I have a array of posts and i displayed it like bellow

    $types = get_post_types( array(  
                                    'public' => true,
                                    '_builtin' => false), 'objects' ); 
    foreach ( $types as $type )
      echo '<li>'.'<a href="'.home_url().'/'.$type->name.'" id="'.$type->name.'">
      <span class="post-text">'. $type->singular_label.'</span>
      <span class="entry-title" style="display:none;">'.$type->description.'</span>
      </a></li>';

I have to unset an array from the array which i have got from the above array, means

    [news] => stdClass Object
        (
            [labels] => stdClass Object
                (
                    [name] => News
                    [singular_name] => News
                    [add_new] => Add News
                    [add_new_item] => Add New News
                    [edit_item] => Edit News
                    [new_item] => New News
                    [view_item] => View News
                    [search_items] => Search News
                    [not_found] => No News Found
                    [not_found_in_trash] => No News Found in Trash
                    [parent_item_colon] => Parent Page:
                    [all_items] => News
                    [menu_name] => News
                    [edit] => Edit
                    [view] => View News
                    [parent] => Parent News
                    [name_admin_bar] => News
                )

            [description] => This will display all the posts under news post type.
            [publicly_queryable] => 1
            [exclude_from_search] => 
            [capability_type] => post
            [map_meta_cap] => 1
            [_builtin] => 
            [_edit_link] => post.php?post=%d
            [hierarchical] => 1
            [public] => 1
            [rewrite] => Array
                (
                    [slug] => news
                    [with_front] => 1
                    [pages] => 1
                    [feeds] => 1
                    [ep_mask] => 1
                )

            [has_archive] => 1
            [query_var] => news
            [register_meta_box_cb] => 
            [taxonomies] => Array
                (
                    [0] => category
                )

            [show_ui] => 1
            [menu_position] => 
            [menu_icon] => 
            [can_export] => 1
            [show_in_nav_menus] => 1
            [show_in_menu] => 1
            [show_in_admin_bar] => 1
            [delete_with_user] => 
            [label] => News
            [singular_label] => News
            [name] => news
            [cap] => stdClass Object
                (
                    [edit_post] => edit_post
                    [read_post] => read_post
                    [delete_post] => delete_post
                    [edit_posts] => edit_posts
                    [edit_others_posts] => edit_others_posts
                    [publish_posts] => publish_posts
                    [read_private_posts] => read_private_posts
                    [read] => read
                    [delete_posts] => delete_posts
                    [delete_private_posts] => delete_private_posts
                    [delete_published_posts] => delete_published_posts
                    [delete_others_posts] => delete_others_posts
                    [edit_private_posts] => edit_private_posts
                    [edit_published_posts] => edit_published_posts
                )

        )

    [wardrobes] => stdClass Object
        (
            [labels] => stdClass Object
                (
                    [name] => Wardrobes
                    [singular_name] => Wardrobes
                    [add_new] => Add Wardrobes
                    [add_new_item] => Add New Wardrobes
                    [edit_item] => Edit Wardrobes
                    [new_item] => New Wardrobes
                    [view_item] => View Wardrobes
                    [search_items] => Search Wardrobes
                    [not_found] => No Wardrobes Found
                    [not_found_in_trash] => No Wardrobes Found in Trash
                    [parent_item_colon] => Parent Page:
                    [all_items] => Wardrobes
                    [menu_name] => Wardrobes
                    [edit] => Edit
                    [view] => View Wardrobes
                    [parent] => Parent Wardrobes
                    [name_admin_bar] => Wardrobes
                )

            [description] => This will show all the posts under Wardrobes post type.
            [publicly_queryable] => 1
            [exclude_from_search] => 1
            [capability_type] => post
            [map_meta_cap] => 1
            [_builtin] => 
            [_edit_link] => post.php?post=%d
            [hierarchical] => 1
            [public] => 1
            [rewrite] => Array
                (
                    [slug] => wardrobes
                    [with_front] => 1
                    [pages] => 1
                    [feeds] => 1
                    [ep_mask] => 1
                )

            [has_archive] => 1
            [query_var] => wardrobes
            [register_meta_box_cb] => 
            [taxonomies] => Array
                (
                    [0] => category
                )

            [show_ui] => 1
            [menu_position] => 
            [menu_icon] => 
            [can_export] => 1
            [show_in_nav_menus] => 1
            [show_in_menu] => 1
            [show_in_admin_bar] => 1
            [delete_with_user] => 
            [label] => Wardrobes
            [singular_label] => Wardrobes
            [name] => wardrobes
            [cap] => stdClass Object
                (
                    [edit_post] => edit_post
                    [read_post] => read_post
                    [delete_post] => delete_post
                    [edit_posts] => edit_posts
                    [edit_others_posts] => edit_others_posts
                    [publish_posts] => publish_posts
                    [read_private_posts] => read_private_posts
                    [read] => read
                    [delete_posts] => delete_posts
                    [delete_private_posts] => delete_private_posts
                    [delete_published_posts] => delete_published_posts
                    [delete_others_posts] => delete_others_posts
                    [edit_private_posts] => edit_private_posts
                    [edit_published_posts] => edit_published_posts
                )

        )

    [journal] => stdClass Object
        (
            [labels] => stdClass Object
                (
                    [name] => Journal
                    [singular_name] => Journal==
                    [add_new] => Add Journal==
                    [add_new_item] => Add New Journal==
                    [edit_item] => Edit Journal==
                    [new_item] => New Journal==
                    [view_item] => View Journal==
                    [search_items] => Search Journal
                    [not_found] => No Journal Found
                    [not_found_in_trash] => No Journal Found in Trash
                    [parent_item_colon] => Parent Page:
                    [all_items] => Journal
                    [menu_name] => Journal
                    [edit] => Edit
                    [view] => View Journal==
                    [parent] => Parent Journal==
                    [name_admin_bar] => Journal==
                )

            [description] => This will show all the posts under journal post type.
            [publicly_queryable] => 1
            [exclude_from_search] => 
            [capability_type] => post
            [map_meta_cap] => 1
            [_builtin] => 
            [_edit_link] => post.php?post=%d
            [hierarchical] => 1
            [public] => 1
            [rewrite] => Array
                (
                    [slug] => journal
                    [with_front] => 1
                    [pages] => 1
                    [feeds] => 1
                    [ep_mask] => 1
                )

            [has_archive] => 1
            [query_var] => journal
            [register_meta_box_cb] => 
            [taxonomies] => Array
                (
                    [0] => category
                    [1] => post_tag
                )

            [show_ui] => 1
            [menu_position] => 
            [menu_icon] => 
            [can_export] => 1
            [show_in_nav_menus] => 1
            [show_in_menu] => 1
            [show_in_admin_bar] => 1
            [delete_with_user] => 
            [label] => Journal
            [singular_label] => Journal==
            [name] => journal
            [cap] => stdClass Object
                (
                    [edit_post] => edit_post
                    [read_post] => read_post
                    [delete_post] => delete_post
                    [edit_posts] => edit_posts
                    [edit_others_posts] => edit_others_posts
                    [publish_posts] => publish_posts
                    [read_private_posts] => read_private_posts
                    [read] => read
                    [delete_posts] => delete_posts
                    [delete_private_posts] => delete_private_posts
                    [delete_published_posts] => delete_published_posts
                    [delete_others_posts] => delete_others_posts
                    [edit_private_posts] => edit_private_posts
                    [edit_published_posts] => edit_published_posts
                )

        )

)

Now i have to remove the “wardrobes” from the array, when i got the the custom post type array.

Is there any function in wordpress or in php. Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:39:35+00:00Added an answer on June 17, 2026 at 2:39 pm

    If you had googled php + unset, you’d have found:

    unset — Unset a given variable

    unset() destroys the specified variables.
    The behavior of unset() inside of a function can vary depending on what type of variable you are attempting to destroy.

    In your example: unset( $types['wardrobes'] );

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array Array ( [0] => posts Object ( [title] => test1
I have the following code: $postcode = $form->createElement('text', 'postcode'); $postcode->setLabel('Post code:'); $postcode->addValidator('regex', false, array('/^[a-z]{1,3}[0-9]{1,3}
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
I have to show all the posts from custom type post on my product
I have an array being collect via a form like below: <select multiple=multiple name=contractors[]
I have this array $test = $_POST['test']; print_r($test); Array ( [0] => Array (
I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I have array INPUTFILES with n files INPUTFILES=( file_0 ... files_n-1 ) And i
I have array of hashes: @array = [{:id => 1, :status=>R}, {:id => 1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.