-
Notifications
You must be signed in to change notification settings - Fork 382
Closed
Labels
BugSomething isn't workingSomething isn't workingPerformanceQA passedHas passed QA and is doneHas passed QA and is done
Milestone
Description
Bug Description
AMP plugin create preview link in admin menu with function amp_admin_get_preview_permalink
But it makes get_posts call which costs a lot especially in WordPress with many posts:
amp-wp/includes/admin/functions.php
Lines 70 to 81 in 7468347
| $post_ids = get_posts( | |
| [ | |
| 'no_found_rows' => true, | |
| 'suppress_filters' => false, | |
| 'post_status' => 'publish', | |
| 'post_password' => '', | |
| 'post_type' => $supported_post_types, | |
| 'posts_per_page' => 1, | |
| 'fields' => 'ids', | |
| // @todo This should eventually do a meta_query to make sure there are none that have AMP_Post_Meta_Box::STATUS_POST_META_KEY = DISABLED_STATUS. | |
| ] | |
| ); |
As a result, users face slow page loads on every admin page.
In my case, the query costs almost 3 seconds.
Expected Behaviour
- Customizer link should be always same(e.g. https://example.com/wp-admin/customizer.php)
- In customizer page of amp, default permalink which
amp_admin_get_preview_permalinkexpected to retrieve will be applied.
Steps to reproduce
- Install WordPress and put 10,000 posts by 100 users in 3 custom post types.
- Install and activate AMP & Query Monitor.
- Open admin page and confirm slow query runs at every page.
Screenshots
Additional context
- WordPress version: 5.2.4
- Plugin version: 1.4.0
- Gutenberg plugin version (if applicable):
- AMP plugin template mode:
- PHP version: 7.2
- OS: Amazon Linux
- Browser: Chrome
- Device: Macbook Pro
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
-
Set AMP website mode to 'Reader' (so that the AMP Customizer menu item is shown):
-
Clicking on it should send you to the homepage, and not the first AMP compatible post
Demo
Changelog entry
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingPerformanceQA passedHas passed QA and is doneHas passed QA and is done

