Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressでクエリー数とページ読み込み時間を表示する方法

あるユーザーから、他のサイトではフッターにクエリー数やページ読み込み時間をどのように表示しているのかという質問がありました。サイトのフッターにはよくこのような表示があります:「64クエリー、1.248秒 “といった具合です。この投稿では、WordPressでクエリー数とページ読み込み時間を表示する方法を紹介します。

以下のコードをテーマファイル(footer.phpなど)の好きな場所に貼り付けるだけです。

[cbk1]

そしてページを更新してください。クエリー数と実行時間が表示されます。

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

アバター

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

7件のコメント返信を残す

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Pattrick

    How can i display only the load Time ?

    • WPBeginner Support

      You would move the echo to after the get_num_queries

      管理者

  3. Aidan

    You should make clear that the timer_stop() function only measures page load time, not how long the queries take to complete.
    These are often related, but the way you present the code makes it look like the queries are always related to the speed issues, and often they aren’t.

  4. Sean Donovan

    It would be useful to know what a typical number of queries are for a WordPress site running 10 or so plugins…

    • Editorial Staff

      Can’t say at all because each plugin varies. You can use 10 plugins that work entirely in the backend which will add no queries on the front-end load. Or 10 really horrible coded plugins that can add tons of queries on the front-end.

      管理者

  5. Thoriq

    It’s so simple, thanks for sharing this tip.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。