Can't edit pages in cornerstone anymore

Best Support,

I want to edit some pages on my website.
But the option edit whit cornerstone wasn’t available on the top.
In the content segment of cornerstone there weren’t any pages i could edit.
I went to settings and tryed to add page to the Allowed Post Types but didn’t let me to selllect page.

I searched and find the topic below so i did uninstall Cornerstone and installed it again by visiting validation.
Still not able to edit or add the the Allowed Post Types.
What should i try next?

Hi @levivdmolen,

Thanks for writing in.

I see that the Page type is not selectable in the allowed post type list. That’s weird since post and page type are default post types that cornerstone allowed automatically upon install.

Would you mind providing your FTP login credentials as well? Maybe I can see something in the error logs

Thanks!

Hey @levivdmolen,

You’ve removed the Page post type from being searchable using a custom function.

Please remove it.

Thanks.

Hi Christian,

Yes this is done for the search result of the wordpress search.
This never has been a problem only after the update.

So if i search team in the search bar i don’t find the page.

But this shouldn’t mean i can’t edit this page whit Cornerstone anymore right.
And the strangest part is that it worked correctly after this costum function was implemented.
Only now there is an problem.

Hi Rad,

Updated the secure note above whit the FTP login.
Is this all you need?

Hi There,

Could you please try updating your code to this?

function search_filter($query) {
  if ( !is_admin() && $query->is_main_query() ) {
    if ($query->is_search) {
      $query->set('post_type', array( 'post', 'product' ) );
    }
  }
}

add_action('pre_get_posts','search_filter');

Let us know how it goes!

Hi Thai,

Where do i need to put this?
And what do i need to delete?

Thanks for the help!

Hi There,

The code should be placed under functions.php file locates in your child theme.

Please delete this code:

function remove_pages_from_search() {
    global $wp_post_types;
    $wp_post_types['page']->exclude_from_search = true;
}
add_action('init', 'remove_pages_from_search');

Let us know how it goes!

Hi Thai,

Sorry for the delay but my workstation broke down 2 SSD’s did break.
Strange and long story but my firsth priority was making sure our production could work again.
And work hard to get on track again.

So i just did update code as you suggested.
And the search doesn’t show the page.
But also in cornerstone i can’t edit a page.

Any other suggestions?

Hi @levivdmolen,

You mean you wish your pages to appear in the search result, and edit them in cornerstone?

I changed this line

$query->set('post_type', array( 'post', 'product' ) );

to this

$query->set('post_type', array( 'post', 'product', 'page' ) );

And it now appears on the search result. Then I added the page in allowed post types, and I’m able to edit the pages in the builder now.

Thanks!

Hi Rad, Thai & Christian_y,

Thanks for the great support so far.
But i don’t want to get any page in the search results.
Maybe my last reply wasn’t clear enough but it not showing in the search was the good part.

But then i can’t edit it in cornerstone anymore. (that’s the bad part)
:slight_smile:

But if there is a problem because of some new way Cornerstone works that it only can work whit posts that are also searcheble then there is no other way to do it.

Is’t there a workaround to edit the search results in another way?

Hi @levivdmolen,

Ah, but still confusing to me. May I know the issue with search results and what’s not displaying? I’m able to edit the pages in cornerstone, would you mind providing the exact URL that you wish to edit? But if you’re referring to search result page then it’s not really editable in cornerstone. The only way to edit is through templates.

Thanks!

Hi Rad,

Sorry i stil think it is not clear.
I would try my admost best to specify the problem/state we are in ad the moment.

Ad this moment i can edit the page whitout any problems.

But the problem is that all pages are getting in the search results ad this moment.

The problem was solved whit adding the pages to the search results.
But we don’t want pages to be show in the search results.

Now an other problem popped up…
Do i need to make another ticket for it?

Because no printers are loading the Cornerstone content ad a single.
And i can’t edit or open it in cornerstone anymore.???
single

Archive

Hey @levivdmolen,

Sorry for the lack of details in my first reply. Cornerstone requires that the post type is searchable. That means if you exclude if from search, you can no longer be able to edit in Cornerstone.

You will need to have an alternative way to exclude pages from search results. A plugin like SearchWP might help. Regretfully, we could not continue on giving custom code because it’s getting into custom development which is outside the scope of our support.

I’m not sure why the custom code worked in your site before when this is a Cornerstone requirement since the previous versions.

For other issues, please open a separate thread.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.