Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
338 views
in Plugins by
Hi,

I have hidden all the unwanted content directly through a MySQL query in the database which was generated for testing purposes.

But the content is still available through search.

So I want to make a plugin that will unindex all the hidden posts from search.

Please help from where I can start.

Thank you!
Q2A version: 1.8.6

1 Answer

+1 vote
by

You don't need to write a plugin for that. You just need to navigate to admin/stats and click on the Reindex content button.

Of course, if other areas have been impacted as well, you might need to click in the other buttons as well: Recount posts, Recalculate user pointsRecalculate categories.

by
Thank you for your advice pupi1985! Reindex takes a lot of time. Reindex is a duplicate task as we reindex the already indexed post. So to avoid this I just wanted to unindex those posts only which was hidden directly from Database Query, this would save a lot of time.
by
So there was no point in hiding them directly using the database from the first place, then. If you were going to code a solution, why didn't you code one that would hide the posts using Q2A? That would have unindexed the posts automatically.

At this point, it's going to be easier to write a process to UNHIDE the post and then to HIDE them. That will take care of all the steps that you missed and will not apply to all posts, only for the ones that are hidden now.
...