The current page number is available in a global variable $paged
.
if ( ! isset ( $GLOBALS['paged'] ) or ( $GLOBALS['paged'] < 2 ) )
{
// run your code
}
Related Posts:
- Custom posts per page does not work with pagination
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Get the number of posts from the current page results
- Pagination on archive.php page
- Having trouble generating pagination links on custom query
- query_posts and pagination, still stuck after much research
- how could I get the pagination as I want to when query posts using get_posts function
- pagination in author.php template returns 404 error
- How do i paginate query_posts with numeric pagination?
- Pagination on custom query
- WordPress pagination showing same posts on each page
- WordPress pagination with get_posts?
- Using ajax with paging and a custom sub-query
- Custom loops, sticky posts, and pagination nightmare
- query_posts pagination will always show identical content
- Can’t get pagination to work for sticky posts only
- How do I use pagination in WordPress?
- Pagination, query more pages at once
- Pagination linking to first page
- filter posts by meta key with pagination
- Modify main loop query for paged and meta key
- Post Filter clearing on pagination $_post
- get_next_posts_link() stops displaying at page 4
- send user to first page of results when reposting to page?
- Achieving pagination with `query_posts`
- posts_per_page no limit
- Query posts: how to exclude results if post is in multiple categories
- query_posts ->using meta_compare / where meta value is smaller or greater or equals
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- WP 5.8 “Query Loop” block: where to place custom query?
- Sort X categories by last update and show image
- order post my meta value m/d/y format with year as included value
- _wp_page_template to dynamically use template
- Schedule Sticky Posts
- Total Count of Posts NOT in Selected Categories?
- ‘paged’ in wp_query doesn’t work
- Problem with single-page for my custom post
- How to modify the query to exclude posts by slug?
- How to make the list of post and load on same page with sub-pages [closed]
- How to get 4 Posts after the 5 most recent ones
- How do I make archives.php for one category only?
- get_meta_data within a loop
- making random query button using $_GET
- Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
- How do I change the default sort order of a custom column on the posts page?
- how to exclude “featured” posts from the main loop?
- Five posts from a category in footer
- Co-authors plus problems with query_post
- Error sending array of inputs
- Search breaks when querying main loop for category
- Authors List page – How to include only those with wp_user_level as Author
- Blog post per page setting conflicting with custom WP_Query?
- Show Blogroll of another WordPress site
- Why this code causes infinite loop?
- Always using the same ARRAY on different querys
- Archive template combined with post slider and regular posts
- Pagination on category.php and tag.php not working
- Currently using a query_posts() in my theme – want to use a request filter in stead
- Pagination for query_posts();
- Breadcrumbs stop working on a specific template file
- Pagination on template page for custom query redirecting to index.php
- Does WordPress run a post query when a page is invoked?
- Multiple posts/pages in one page?
- Order for custom field after the loop
- Custom post query error
- Multiple instances of query_posts
- Paginate pages with dynamic query
- Different layout based on post amount?
- If Query Post Returns 1 Post
- Keeping get_posts’ offset and is_paged() synchronized
- odd behaviours from template tags
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Instead of 4 loops, how can I do it better?
- How to get any type posts include attachments by ids?
- Create a Loop with Posts Ordered by Most Recent Comments
- Specifying image size used in template the_content
- Use WP pagination functions on a custom page template
- allow user to edit posts made by others users based on the user role
- Pagination does not work with query_posts()
- Pagination not working on my archive page for a custom post type
- No duplicate tags by category
- Order posts by ACF checkbox
- Post per page not working
- Show previous month’s posts
- why is pre_get_posts not working
- query_posts result differs from wp_query request result
- How to inject a post within a loop
- orderby not working for query_posts using array of IDs
- Collect posts from last 48 hours
- How to go to tag archives using a form
- Showing one post from each category, paged?
- query posts returns 10 records
- Sort posts with multiple meta_keys
- How to get custom post type posts with certain multiple tags names and category id?
- Create “archives by year and week” by category template
- query_posts different amount of posts per page [duplicate]