This the code I have so far which looks like it does the job, I still wonder if there is a API function for the job:
/**
* @param (int) $category_id
* @param (int) $pagenum
* @return string
*/
function get_category_paged_link($category_id, $pagenum)
{
global $wp_rewrite;
$link = get_category_link($category_id);
if ($wp_rewrite->using_permalinks() || $wp_rewrite->using_index_permalinks())
{
$link = sprintf
(
'%s/%s/%d/',
rtrim($link, "https://wordpress.stackexchange.com/"),
$wp_rewrite->pagination_base,
$pagenum
);
}
else
{
if (false === strpos($link, '?'))
$link .= '?';
else
$link .= '&';
$link .= sprintf('paged=%d', $pagenum);
}
return $link;
}
Related Posts:
- Why is per_page not working with categories in WP API?
- Category links suddenly started giving 404 errors
- Any way to assign Post Categories and Tags to Links?
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- How to enable category hierarchy for links?
- How to run select query of post with category and tags for API?
- Combining post categories and link categories?
- Displaying a full post instead of a slug per category?
- Link Attachment Image to Category
- Class active for Archive link – looped out
- Why do my categories redirect?
- Get category url in loop
- Older entries link within category page
- Style category link depending on category ID
- WordPress Drop down category as array for using in page builder
- Link To Child Category For A Post
- How to not display a category post on blog page?
- Link from navbar to categories
- javascripts files not linking to my category slugs?
- wp_insert_link not working
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- Show Subcategory Name Instead of Parent Category
- Link For Portfolio Categories
- How to get the link of all categories
- Featured image for links and categories
- Categories as selectable links on submission form
- Displaying categories and subcategories without link
- How to get category slug link? ( include parent categories)
- Trouble Fetching Posts Using WordPress API: No Response from Specific Category
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Activate Gutenberg in category-descriptions
- How to show subcategories in categories else show posts
- How would I increase the Author Role to be able to add a new category?
- How to remove the parentheses from the category widget
- Filter front page posts by category
- How to get the url to tag & category base set by the user?
- How to: 301 Redirect /category/ to /customname/
- Root level category, tag, author and archive pages to work
- Display one latest post from multiple categories
- Archive pagination causing 404 with permalinks structure
- Get a list of Terms for a specific category
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- How Do I Merge Categories With phpMyAdmin
- Edit the markup of categories list
- Show category children, one level
- a-z list, categories and sub categories in loop
- Category slug $_SERVER[‘REQUEST_URI’];
- wp_dropdown_categories and custom taxonomy + custom post type
- Random taxonomy category list
- Linking products to categories
- Show all posts for a specific category/author
- Resort get_categories
- How to call custom category field data in theme?
- Query Posts Exclude Entire Category
- One Specific Category To Permalink
- WordPress category widget only show categories with children
- Woocommerce custom category page with pagination [closed]
- Menus don’t work after 4.4 [closed]
- Custom post and category template pagination problem
- Admin comments and user restrictions
- category url structure
- Order by category titles
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- How to let users choose posts order in categories?
- WordPress category
- Different Output for “Every Other” Foreach Statement?
- And/Or Category Query
- Show subcategories on a parent category page
- not all categories being displayed
- Category archive is displaying all posts rather than the specific category
- Use the category name instead of category slug in permalinks
- How to display sticky or latest published post on the current category page it belongs to?
- Custom Meta Box (SELECT2) Not Saving Taxonomy Terms
- How do I add a separator to my list of terms with get_category
- Listing posts under a category by date
- Display content from a specific category using cat ID not working
- Trying to create a Categorised Index (archive?) to use as my Home Page
- Deleting a category from WordPress admin does it remove it completely from the database?
- Hide categories from frontend, but not admin / post editor
- Post to inherit custom category background image from parent
- Last x Posted Categories?
- Check boxes for showing categories
- echo site_url() returns a different value than what is in the database siteurl field
- Is there a “sensible” limit to WordPress Categories?
- Possible to make get_categories() hide_empty attribute honor excludes from post query?
- Display Category Name and Date Posted on Blog Post
- How to remove “Categories:” part after the post title? [closed]
- Editing categories crashes WordPress site
- Conditional Site Logo(Category Based)
- Tag Menu items based on their categories
- Accessible Subcategory URL’s pages without using .php hack
- in_category(‘category-sluga’) returns true for Archive page of Category ‘category-slugb’
- wp_list_category only showing to logged in uers
- Grouping parent categories into sections
- Querying Multiple Categories With Different Offsets
- altering theme – content generated by PAGES not PORTFOLIO
- How do i add custom post types to this query?
- add new input field like category?
- WordPress excerpt for specific posts in category
- How do I get a single page navigation depending on the previous page?