The functions the_permalink()
and the_title()
print their results by default. Use get_permalink()
and get_the_title()
instead:
while($query->have_posts()){
$query->the_post();
$url = get_permalink();
$keyword = get_the_title();
Print('<p>' . $url . '{' . $keyword . '}' . '</p><br>');
}
Related Posts:
- Transaction when using WP functions rather than vanilla SQL?
- Use wc_enqueue_js only on specific pages – nested add_action
- WordPress theme & site not loading after moving files
- Removing unnecessary wordpress files
- WP_Query use for a filter with multiple Taxonomies and Terms
- WP Plugin + OOP: Adding Menu Page doesn’t create required effect
- Use is_product_category() properly
- list posts and wrap them alphabetically A-Z
- Style wp_page_menu() items
- Link to the parent post in attachment page
- Convert all images to PNG on file upload
- White Screen of Death – wp-admin
- How to update WP about renamed files
- How to sanitize my cookie name
- Handling Body class based on Template
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Changing layout with wp_customise
- Get updated query results on page after insert in database
- Mass update excerpt
- Show prices with tax in Woocommerce Mini Cart [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Get post id in a function when edit/add a post
- Reconfiguring WordPress site
- Use Icomoon external svg file with
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- get_template_part based upon post’s category
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Query if audio attachment AND/OR custom field
- Database query works fine outside WordPress
- Loading index.php contents which located outside blog folder for post single page
- WordPress page content outside WordPress
- Pull Tags But Not as Links
- Define specific category name in PHP
- Can I get an email notification when media is uploaded to the media library?
- How to solve Woocommerce Memory Limit
- Shortcode to find and replace URL
- How to add drag and drop functionalities to a div inside option panel
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Seo Friendly Filter URLs
- PHP contact form not redirecting [closed]
- Add value to new attribute inside WordPress menu items
- Please show me how to use an if/else statement in combination with wp_enqueue
- Add new post in existing categories using wp_insert_post
- I’m unable to call img path using single quotes in an array?
- Else/If Statement to Display Photo Descriptions
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- Correct code to use php in text widget
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- custom header text
- Display additional page templates and a sidebar on plugin activation
- Too many errors on log
- I am trying to edit the homepage of the Shopper. Since published I can not make changes and wanted to see if i can disable in (tpl-page-homepage.php)
- I need to display posts in subcategory beside posts in main category
- Trying to copy linux blog locally with XAMPP – php fatal error
- unsetting actions (edit and trash) of specific posts from that list of all pages or posts based on each posts metabox value
- Add a Metabox checkbox to the Page Edit screen of wp-admin , which only certain roles can see and Makes only certain roles able to Edit said page
- Custom URL for multiple categories hierarchy
- Display Results of SQL Query on WP site
- How to search order using database frontend short code WordPress
- if get_post_meta is empty echo a placeholder or shortcode
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- Internal Server Errors – Moving working multi-site install to my localhost
- How to display MySQL table data which is stored as an array?
- Categories does not show Block editor WordPress
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- WordPress Slick Slider + Magnific Popup
- Fix common misspellings/errors based on array of replacements
- Search for single post by 2 tags
- Import Instagram post as WordPress post
- How to put a before and after with tags in a wordpress entry?
- How to call a WP Class inside my theme
- spl_autoload_register is slow for WordPress sites
- Contactform7: display results from CURL
- Adding a widget under an ‘Add to Cart’ button through a PHP snippet
- How to update option field in database on clicking the publish button in customizer
- Allow Submit Contact Form Default Text In Text Box
- Get current_post in reverse order with pagination
- Add ID to output only for first option
- get_post_thumbnail_id returns a negative number
- Front end/Database connection in WP
- Escaping html for meta description
- How to make 2 similar functions more efficient
- how use php query in AJAX jquery
- Div Missing In Custom Loop Query
- Functions are causing errors
- Select All not working in a WordPress search filter
- Custom Meta Box If Else Statement
- Static pages not being allowed
- How to set if meta_value is lower < than other meta_value in a get_posts array?
- Global variables and re-use
- AJAX: WordPress filters inside $html do not work as intended
- Why is my footer missing [closed]
- how to change “Read more” button position [closed]
- How to format PHP if statement? [closed]
- FATAL ERROR , Sommerce Theme [closed]
- How can I change the URL via add_rewrite_rule()
- Variable ++ in query loop
- Generate and upload screenshot as featured image for user-submitted post
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress