You can use get_query_var('paged')
, this will return the current page in pagination.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
Or the shorter form
$paged = get_query_var('paged') ?: 1;
Related Posts:
- PHP Deprecated: Non-static method should not be called statically
- Adding Custom Fields for Img in Posts
- How To Ignore a Filter On Applying Filter the Content In a Function
- Calling function from within functions.php returns unwanted value
- shortcode doesn’t work
- Can’t get custom posts of taxonomy to show
- Shortcode to generate and save password in a file
- get shortcode value
- Storing Options in a Shortcode
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- How to put JQuery/Ajax inside shortcode?
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- WordPress function not being called from jQuery method
- Nested shortcode functions accessing variable
- Some code in shortcode function being ignored
- How to Create a shortcode to this php function
- Redirect to another page using contact form 7? [closed]
- What is @Action in WordPress?
- Custom shortcode for displaying user based on a role parameter
- Return multiple values in a shortcode attribute
- Is there a way to convert shortcodes to html content?
- Shortcode not working – quotes seems strange
- Get all the URLs of the pages that uses a specific shortcode
- Add the_post_thumbnail_url to a shortcode in function.php
- Echo out element to another page.
- Adding a Tag Parameter / Filter to My Shortcode
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How to get current cart values using WC_Shortcodes?
- get_post_meta shortcode returns empty field
- How do I use a plugin’s shortcode attribute value in another function?
- Why does my custom plugin only function correctly once per page?
- Hide content for specific users with id
- Why is my shortcode not working?
- Get Shortcode output to database for static post_content
- Query Shortcode from a multisite to appear on a different site?
- Find all strings between an enclosing shortcode
- Posting code inside the post instead of in the template file using shortcode
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Creating Features List in WordPress Post
- Integrate Razorpay quick payments plugin with contact form7 plugin
- cURL External API request displays content above other content on page
- Subtract Using GravityWP Count Plugin
- qTranslate‑X is not translating all shortcodes
- __(): What if I have to pass in a variable?
- category_name not working (not showing up in sql query debug)
- How can I make my custom shortcode work in a Custom HTML Widget?
- WordPress Hook that will run when media file deleted
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How can I make the “Preview Post” button save and preview in the same window?
- Escape special characters in image link
- Cannot run the code after I activate the plugin
- Displaying admin notice dynamically
- Get total number of comment of the posts written by an author
- May i Use ShortCode in Template?
- printf – problem to understand code
- Auto delete WordPress users according to time
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- add_query_arg not working
- How can I create a custom shortcode that will return a custom post type by ID?
- Theme my Login plugin, how to update fields
- CSS from textarea in options page to frontend what to do
- Making a Template for a CPT created by a plugin
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Why is my custom post type not being activated on plug-in activation?
- Where to find the code used to render a page that has a shortcode and a template defined?
- What happens when WordPress memory limit is exceeded?
- how can I do something on new user registration?
- convert more tag to shortcode
- Any idea how to get something like this to work? [closed]
- wp_dequeue_script for a Plugin
- How do I add $_SESSION[”] to my wordpress page?
- Built a second plugin but it overwrote the first one
- WordPress: Add custom add_filter for custom functions
- How to change layout of shop page in wordpress? [closed]
- preg_replace() No ending delimiter ‘.’ found [closed]
- How can I achieve this, using shortcodes
- Categories from front-end, checkbox selection doesn’t work
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- Calling PHP function with AJAX
- Looping the data from WordPress database using foreach
- Rename a folder via HTML POST request
- Add two row of code to the public static function init of a plugin
- Failed to load resource: the server responded with a status of 500 () post.php
- WordPress filter from custom table is not working properly
- Configuring default woo commerce login with modal popup
- How to add HTML to a template only when user is logged out/ not registered
- Adding link for logged in user? [closed]
- Create csv file in plugin
- Changes required to make new plugin from existing
- Plugin Breaking WordPress Login
- How can I allow for the password protect feature to allow visitors to enter any number at all?
- Display static pages instead of category, in code
- What is the source outline for a basic word press plugin?
- Allow users to download media files directly from Amazon S3 (AWS plugin)
- Like/Dislike plugin crawler problem
- Adding a script & php to functions.php
- How to rename files during upload to a random string?
- WordPress Convert queries to slashes using function.php