How to edit query.php file in wordpress

4 replies
Hello

I need help from expert here. I need to edit query.php file which is located in wp-includes folder. I can see the file in ftp (filezilla) but in order to edit using wordpress, I can't find where the file is.

I go to Appearance -> Editor

There is no query.php because the Editor is located in WP-admin folder (not WP-includes folder).

Anyone can assist?

Thanks.
#edit #file #query php #queryphp #wordpress
  • Profile picture of the author HJdev
    Why not edit the file with your FTP editor? Or notepad.

    Editing core files is not recommend, in future updates it can be overridden. Take a look at hooks: Plugin API « WordPress Codex
    {{ DiscussionBoard.errors[9823910].message }}
    • Profile picture of the author Zenoth
      Never edit the WordPress core files!

      That's the reason why WordPress offers you a lot of filters and ways to make custom queries from your theme or plugins.

      You will lose the changes when you will upgrade your WordPress version.

      And why would you want to edit query.php file?

      The WordPress core files won't be displayed in the file editor from WordPress dashboard. You will be able to edit only theme files from that location.
      {{ DiscussionBoard.errors[9824140].message }}
  • Thanks HJDev and zenoth. The reason is because I want to remove a certain category from the blog page.
    {{ DiscussionBoard.errors[9826202].message }}
    • Profile picture of the author Zenoth
      Originally Posted by HandsomeMillionaire View Post

      Thanks HJDev and zenoth. The reason is because I want to remove a certain category from the blog page.
      You don't need to edit query.php for that.

      You just need to alter the query for your blog page using http://codex.wordpress.org/Plugin_AP.../pre_get_posts or replace your current query (in template files of your active theme) for your blog page with a custom query that excludes that category.
      {{ DiscussionBoard.errors[9826472].message }}

Trending Topics