The best approach, from my point of view, is to use add_query_arg()
function:
$only_conent_url = add_query_arg( array( 'content-only' => 1 ), get_permalink( $post->ID ) );
And then you can escape it if you need:
esc_url( $only_conent_url );
add_query_arg()
takes the URL passed as second paramenter and append a properly formatted query string built from the key=>value pairs contained in the array passed as first argument.
Related Posts:
- how to get page id of a page using page slug
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- Passing the page ID to a login php script
- get_users(…) only returns one user
- Open post-content in archive page in a Modal box with bootstrap
- Making (and edit existing) posts with ID included
- Help getting previously visited pages ID
- get_the_ID() in the footer returns wrong value
- Use post ID in functions.php file adminside
- create front-end users post list by specific category
- php return username of currently viewed author profile
- Give ID to divs inside the loop
- How to block specific user id in custom login form?
- Get current user id in function php
- Trying to get post ID outside loop on blog page
- Trying to get property ‘ID’ and ‘post_author’ of non-object error
- How to get the url of the entry in which an image belongs
- main menu page redirects to user ID
- WordPress PHP version requirements
- Passing PHP Variables to JS using Localize Script
- Exclude pages with certain template from wp_list_pages
- Is Auto Post recognition a WordPress feature? How to turn it off?
- Generating a random number on every post and saving it in database
- Include a specific post to the query_posts and remove it if it is already in the returned list
- Warning: Use of undefined constant HTTP_USER_AGENT – assumed ‘HTTP_USER_AGENT’ (this will throw an Error in a future version of PHP)
- How to convert objects into arrays
- Huge debug.log because of “undefined offset in media.php”
- Part of title duplicating but not sure how to remove from code – help?
- Create a hierarchical taxonomy list in WordPress
- Randomly Assign an Image’s Alt Text Based on Data From Post
- How can I Add a variable PHP in the Menu Nav
- Pull the content out of a page
- Adding an Avatar to the Top Nav Bar
- How to add seperate classes to no-search-result and found-search-result pages on wordrpess search – is_search()
- Edit incorrect password message WordPress
- A non-numeric value encountered in /wp-includes/functions.php on line 68
- XAMPP-VM Mac OS Mojave wordpress debugging using XDebug
- Ajax load more button for comments wordpress
- WordPress & Fastcgi proper setup?
- Update user profile information from functions.php
- Checkbox doesn’t stay checked, conten
- How do I Import / Upload Files with jQuery AJAX?
- Variable not staying set
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to set the WordPress logo programmatically with PHP
- Function won’t run onclick using Ajax
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- List all blogs, but exclude the main site
- How to specify the path for require_once in a child theme?
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- $_SESSION variable not saving on page refresh or new page
- Form search query – displaying ACF “Post Object” field as results
- Disable if there are no children – Woocommerce
- How to echo every parent page title?
- change default RSS feed URL
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Sorting users by a field, not by ID
- How to get thumbnail with pure PHP in a WordPress database?
- Edit Account – read and write to MySQL
- Looping through 3 recent posts but separating them into separate divs
- OG:Audio facebook meta tags
- WordPress stripping out custom field tags
- How do you save the values from custom fields to a products data
- understand what code is doing when prepending /blog
- Show next image in array if page is revisited by same logged user
- PHP Fatal error: Uncaught Error: Call to a member function atp_variable() on null
- Adding markup to sub menu based on class
- How to create a subdirectory in a child-theme via functions.php from the Theme editor without FTP acces?
- Set ACF on order during checkout
- Fatal error: wp-settings.php on line 199
- Dynamic Banner Text based on Subdomain
- Show a text if the post has written by author user role in WordPress
- How to programmatically set existing image in media library the featured image for a post in wordpress
- add_filter() inside another add_filter()
- Use WP user status (logged_in) to manage access to independent application
- custom search query database in child theme
- Add Admin Option w/ Anonymous Function
- Getting data from serilized array
- Else if Statement for Advanced Custom Fields [closed]
- Woocommerce custom field on emails outputs ‘Array’
- Form direction to .php on localhost
- Use html tags in shortcode_atts, is it real?
- How do I display Category titles on a WP Page?
- Can form entries from a WordPress form go to a database
- News and Featured image
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- How to have Function of a plugin using global vars into a shortcode?
- Cant get theme to change footer color through theme customizer
- add conditionals to a displayed external xml feed
- Warning: Cannot modify header information (with a twist)
- HOW TO Insert Existing PHP Code to WOrdPress
- where is the mistake in PHP Warning: Invalid argument supplied for foreach() in line 3
- Echo piece of code from file
- WPMU – How to echo only one URL
- WordPress Query -> Ajax Query
- Can WordPress support Website (19GB database) Should I move Our WordPress Website to a custom one using Laravel or any other PHP framework?
- WordPress Importer Call to undefined function set_time_limit()
- Display terms on product page with shotrcode
- How to build a dropdown with tags for same post type?
- getJSON response to PHP