Title: umchal's Replies | WordPress.org

---

# umchal

  [  ](https://wordpress.org/support/users/umchal/)

 *   [Profile](https://wordpress.org/support/users/umchal/)
 *   [Topics Started](https://wordpress.org/support/users/umchal/topics/)
 *   [Replies Created](https://wordpress.org/support/users/umchal/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/umchal/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/umchal/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/umchal/engagements/)
 *   [Favorites](https://wordpress.org/support/users/umchal/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 81 total)

1 [2](https://wordpress.org/support/users/umchal/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/umchal/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/umchal/replies/page/4/?output_format=md)
[5](https://wordpress.org/support/users/umchal/replies/page/5/?output_format=md)
[6](https://wordpress.org/support/users/umchal/replies/page/6/?output_format=md)
[→](https://wordpress.org/support/users/umchal/replies/page/2/?output_format=md)

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14740319)
 * I had somebody to check on wordpress.com and
 *     ```
       require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
       ```
   
 * works as their path constants are
    - ABSPATH: /wordpress/core/5.8/
    - WP_CONTENT_DIR: /srv/htdocs/wp-content
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14731348)
 * > For dbDelta and similar, ABSPATH . ‘wp-admin/includes/filename.php’ should 
   > be fine since /wp-admin/ is supposed to not be moved or renamed.
 * Are you certain that it works on wordpress.com as well? I’m not familiar with
   their platform. Just in case you or somebody else might know it.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14730458)
 * Hello,
 * > Other options?
   >  [https://developer.wordpress.org/reference/functions/admin_url/](https://developer.wordpress.org/reference/functions/admin_url/)
 * You shouldn’t use a url to include a PHP file. We need a PATH to the wp-admin
   directory.
 * > Here’s a good thread:
   >  [https://wordpress.stackexchange.com/questions/119064/what-should-i-use-instead-of-wp-content-dir-and-wp-plugin-dir](https://wordpress.stackexchange.com/questions/119064/what-should-i-use-instead-of-wp-content-dir-and-wp-plugin-dir)
 * It doesn’t mention the wp-admin path.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14730377)
 * Hello,
 * > If WP_CONTENT_DIR is being stored as a constant, then the dir path should be
   > fine.
 * We are not taking about `WP_CONTENT_DIR` itself but the `wp-admin` path. In many
   cases, `dirname( WP_CONTENT_DIR ) . '/wp-admin'` would give the correct path 
   for the `wp-admin` directory. However, sites with a custom path set to `WP_CONTENT_DIR`
   will have a problem with the code like
 *     ```
       require_once( dirname( WP_CONTENT_DIR ) . '/wp-admin/includes/class-wp-list-table.php' );
       ```
   
 * > There are plugins / people etc, that choose to rename their /wp-admin directory
   > tho.
   > Is that what you mean?
 * No. I’m not talking about cases that users manually edit core directory names.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14730241)
 * Hello,
 * > At first guess, I would say that the WP_CONTENT_DIR is being stored as a CONSTANT,
   > so would render the right path whether it is custom or not.
 * It doesn’t mean `dirname( WP_CONTENT_DIR ) . '/wp-admin'` always gives the right
   path among sites with different path configurations.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Reliable way to Include files under the wp-admin directory](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/reliable-way-to-include-files-under-the-wp-admin-directory/#post-14729185)
 * Hello,
 * > Why are you trying to include files under the WordPress core?
 * If you want to use certain functions and classes such as `dbDelta()` and `WP_List_Table`
   defined in the files under the wp-admin directory in your plugin, you need to
   include them first. See [here](https://www.sitepoint.com/using-wp-list-table-to-create-wordpress-admin-tables/)
   for example.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Connect Matomo - Analytics Dashboard for WordPress] Way to avoid being blocked by ad-blocker](https://wordpress.org/support/topic/way-to-avoid-being-blocked-by-ad-blocker/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/way-to-avoid-being-blocked-by-ad-blocker/#post-12398922)
 * Thanks for the clarification!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Connect Matomo - Analytics Dashboard for WordPress] Way to avoid being blocked by ad-blocker](https://wordpress.org/support/topic/way-to-avoid-being-blocked-by-ad-blocker/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/way-to-avoid-being-blocked-by-ad-blocker/#post-12398741)
 * Thank you for the very clear instruction. I get an impression that it’s quite
   complicated as it seems the best workaround at the moment though. Also, will 
   those copied files remain after Matomo updates?
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [WP_Query: retrieve posts of publish and private of the logged-in user](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/#post-12274891)
 * Wait, I was testing with the administrator privilege. When I test with the subscriber
   user roll, the query indeed is what you said.
 * So, it’s all done by default.
 * Thanks.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [WP_Query: retrieve posts of publish and private of the logged-in user](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/#post-12274877)
 * Ah,
 * When I test it with a logged-in user, actually the generated query is like this
 *     ```
       SELECT SQL_CALC_FOUND_ROWS  wptests_posts.ID FROM wptests_posts  WHERE 1=1  
       AND wptests_posts.post_type = 'test' 
       AND (wptests_posts.post_status = 'publish' OR wptests_posts.post_status = 'private')  
       ORDER BY wptests_posts.post_date DESC LIMIT 0, 10
       ```
   
 * The part `AND (wptests_posts.post_status = 'publish' OR wptests_posts.post_status
   = 'private')` is indeed automatically added by default. Maybe this is what you
   mean.
 * Still, the post author’s part is missing though.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [WP_Query: retrieve posts of publish and private of the logged-in user](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp_query-retrieve-posts-of-publish-and-private-of-the-logged-in-user/#post-12274845)
 * Hi,
 * So do you mean you have to manually write a SQL query? It is what you mean by
   default? I might be missing something.
 * When you do this,
 *     ```
       $q = new WP_Query(
           array(
               'post_type' => 'test'
           )
       );
       $q->request
       ```
   
 * by default, the generated database query by WordPress is like this
 *     ```
       SELECT SQL_CALC_FOUND_ROWS  wptests_posts.ID FROM wptests_posts  WHERE 1=1  AND wptests_posts.post_type = 'test' AND (wptests_posts.post_status = 'publish')  ORDER BY wptests_posts.post_date DESC LIMIT 0, 10
       ```
   
 * It does not handle the asked conditions like the `private` post status and `post_author`.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Misleading doc-block description for the current_time() $gmt parameter](https://wordpress.org/support/topic/misleading-doc-block-description-for-the-current_time-gmt-parameter/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/misleading-doc-block-description-for-the-current_time-gmt-parameter/#post-12232102)
 * Wait, `Greenwich Mean Time` might mean the time without any offsets. In that 
   case, it’s not a problem. I thought GMT time means a time with some GMT time-
   zone offsets.
 * —-
    By the way, I thought this forum section is for Fixing WordPress, meaning
   fixing the WordPress core issues. But when I read the description of the forum,
   it says,
 * > For any problems encountered after setting up WordPress.
 * There are lots of misleading titles out there.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Default sorting posts of custom post types with the `hierarchical`](https://wordpress.org/support/topic/default-sorting-posts-of-custom-post-types-with-the-hierarchical/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/default-sorting-posts-of-custom-post-types-with-the-hierarchical/#post-12225836)
 * Ops, I said the opposite. You’re right: to list posts in the order that latest
   ones come first.
 * So we both agree with that point about what “normal” is.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Default sorting posts of custom post types with the `hierarchical`](https://wordpress.org/support/topic/default-sorting-posts-of-custom-post-types-with-the-hierarchical/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/default-sorting-posts-of-custom-post-types-with-the-hierarchical/#post-12225707)
 * > What is “normal”?
 * To list posts by the order they are created. Even pages are sorted in that manner.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Post Type UI] Hierarchical option changes the default sort order in the All Posts table view](https://wordpress.org/support/topic/hierarchical-option-changes-the-default-sort-order-in-the-all-posts-table-view/)
 *  Thread Starter [umchal](https://wordpress.org/support/users/umchal/)
 * (@umchal)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/hierarchical-option-changes-the-default-sort-order-in-the-all-posts-table-view/#post-12222407)
 * I tested with manual coding and it seems that it’s not your plugin but the WordPress
   core behavior.
 * Sorry for bothering.

Viewing 15 replies - 1 through 15 (of 81 total)

1 [2](https://wordpress.org/support/users/umchal/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/umchal/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/umchal/replies/page/4/?output_format=md)
[5](https://wordpress.org/support/users/umchal/replies/page/5/?output_format=md)
[6](https://wordpress.org/support/users/umchal/replies/page/6/?output_format=md)
[→](https://wordpress.org/support/users/umchal/replies/page/2/?output_format=md)