I wouldn’t classify this as a WordPress issue persay. The problem is that any get_*()
functions return values. This means that get_permalink()
returns the permalink to be assigned ot a variable which you’re not doing or intend to do in this case. So we have the value sitting in memory all we need to do is print / echo
it:
echo get_permalink( $post_id );
Or in your case:
<input type="button" class="cta-button" value="Newsfeed" onclick="window.open('<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>', '_self')">
Related Posts:
- Handling an Ajax form submit
- Using a javascript file to access a get posts array
- Open post-content in archive page in a Modal box with bootstrap
- Post repeating with infinite scroll
- Load Posts on Click via Ajax into a DIV
- Incrementing PHP variable onclick to display posts by month
- duplicate posts with ajax load more wordpress
- Post form – AJAX won’t upload featured image – Plugin development
- Disable Attachment Pages Completely
- Combine CSS and JS files from plugins
- How to call a PHP function from Javascript in WordPress
- Display posts by month
- Custom SQL query to get List of posts with featured image url
- How to preserve PHP modifications while upgrading WordPress?
- Get post meta in enqueued js file
- Nice scroll to wordpress
- How to block specific keywords from searching on WordPress?
- How to create filterable portfolio in WordPress?
- WP Insert Post function – Insert Post Thumbnail
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- How is WordPress manipulating the posts like there are folders?
- admin-ajax.php responding with 0
- How can the plugin directory path be returned into ?
- How to make custom total price reactive in navigation
- Adding tawk.to code just before body tag on functions.php file
- Deregistering a script in WordPress seems impossible
- How to prevent those PHP variables from being cached on WordPress?
- Show post in slider
- How can I use a modal window to display the current post in loops featured image?
- Trigger popup in a php if/else statement
- How to select the contents in the text view textrea in wp_editor?
- How to pass aa JS variable to PHP?
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Which hook/action will help me solve my problem?
- wp attempt focus, disabling without touching core
- PhantomJS with wordpress
- Get children post mime type using parent post_ID wp_post
- Accessing WPDB Multidimensional JSON Array w/ Javascript
- wordpress wp_enqueue_script() not working
- Redirect to another page using contact form 7? [closed]
- How to avoid duplicates when creating recent network posts
- Update post title from external file?
- set post limit at load more ajax wordpress
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- Can’t add script immediately after the opening tag on login page?
- Override user-edit.php to design own profile page
- Array to string conversion on array_map
- How to use mysql LIKE with wpdb?
- Do I need to edit my theme in order to change the title of my blog page?
- Do not duplicate posts with multiple categories in multiple loops
- JS file is not loading when i put wp_head() and wp_footer
- WordPress Search
- Update value of a associative array with update_post_meta
- How to add 3 weeks to the_time() function
- Replacing WordPress Icons (menu,icons32, etc)?
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- How to sort posts by active category in WordPress?
- Additional file upload in Gutenberg page options/featured image
- Display WordPress search results based on the selected Sub-Category
- Edit and delete permissions pages and posts
- Variation prices breakdown only for single product page
- Woocommerce disable order item link (backend) [closed]
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- How to add JS script in specific pages in WordPress?
- Load more posts using AJAX based on posts inside WP_Query
- How can i find wrong word in search box and replace with correct word
- posts_per_page displays only 2 posts instead of 4 posts
- How to use wp_ajax_set_post_thumbnail?
- Passing a value from an input field to a php function in WordPress?
- Display one random image from Media Library
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- WordPress recent post
- Need to show 7 posts from actual date
- Can I disable auto increment of WordPress Posts Database to utilize previously deleted records?
- Using wp_editor() when not logged stopped working
- Modifying child theme’s header
- Show subcategory name selected in specific category woocoommerce
- Move Jquery.js to Footer
- My blog posts section seems to be rendering the other blog posts inside the first? :/
- LinkedIn Share Post Button
- Get the total Author Favorited posts
- How do I generate formatted permalinks as specified in backend options?
- How can i iterate through this shortcode array?
- Setting at job with shortcode not working
- How to use Amazon Elastic Transcoder from WordPress using AWS SDK for PHP?
- Slider from different widgets
- add bootstrap modal after login in wordpress
- How to get values from wordpress listings and use them in javascript array?
- Insert wordpress tags below posts via functions.php
- Help with my first Metabox helper class
- Trying to customize wordpress drop down categories
- Add multiple JavaScript files to template header [duplicate]
- Add specific phrase after every product title including the discounted price? [closed]
- Display post of specific category on page
- Import and use a variable in additional settings of Contact Form 7 [closed]
- Is there a better way to output HTML as a shortcode?
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- Bulk data save in custom table