Filters are for modifying values before they are output. Typically the function is passed some value where you can modify it or overwrite it, then pass the result back. Your link is appearing out of place because you’re outputting the value directly, change it to return instead.
Also note that most template tags have versions that output their value, and ones that return. In your function the_permalink is changed to get_permalink.
add_filter( 'excerpt_more', 'edit_more_link', 11 );
function edit_more_link() {
return '<a class="read-more" href="' . get_permalink() . '?template=iframe">read more »</a>';
}
Related Posts:
- Get excerpt from $post->post_content
- How to use the_excerpt in a filter hook?
- add_filter on “the_excerpt” only works when post does not have excerpt
- End excerpt at the end of the sentence
- get_the_excerpt() with fallback like the_excerpt()
- How do I filter get_the_excerpt() but keep all of its functionality intact?
- Buddypress: Edit activity when new blog post [closed]
- Why in archive page doesn´t show read more button with excerpt?
- the_excerpt filter with an empty excerpt
- Access get_the_title() from ‘excerpt_length’ filter
- Give “Read More” precedence over excerpt() word count
- How do I override the_excerpt so that it will display full content?
- the_excerpt filter doesn’t work as expected
- Excerpt is being added above the content, but it should be after it
- run shortcode in excerpt of single custom post type
- apply_filters(‘get_the_content’, $content) + Except
- Trimming a custom field to a length
- Adding html banner to posts
- Apply wordpress filter checking category
- Add Filter – Pass Variable (PHP < 5.3)
- Filter Post Title without affecting screen-reader-text
- Create different flavours of excerpt
- Cutting off excerpt with first sentence
- Auto-generated excerpt with shortcode and read more button/text link
- Read More in the actual excerpt
- is_page_template() doesn’t work with excerpt_length filter
- the_excerpt() does not work with has_excerpt()?
- get_the_excerpt on mobile still displays continue reading
- Custom excerpt_more filter not working when tag is present
- wp_mail works with add_action(‘save_post’, …) but not an ajax action
- add_filter with retrieve_password_message() not working in plugin, but works in functions.php
- How to check if a protected hook is hooked?
- Add a div of content within the_content after a certain block
- Gutenberg Block – Post Featured Image Filter Hook
- Can i use multiple ‘the_content’ filters?
- Is it possible to put the add-filter()-hook into a function?
- How can I return shortcode output to the top of the content?
- separate categories with comma and srounded by single quote
- Filter for when the post is updated
- Prevent add_filter being applied to wp-admin pages
- Translate custom order status through a filter?
- Using preg_replace() with the_content filter
- term_link filter gives less atributes
- Filter a pluggable function
- Add mime types with plugin
- Filter media upload attachment meta
- Filter have_posts()/ the_post()
- Is there a way to globallly apply esc_html( … ) to all inputs and anchors to filter out XSS markup?
- Filter wp_redirect() to stop redirect under certain condition
- Filter get_page_by_path()
- Handle multiple parameters in filter
- How to add filter in custom rss feed
- Want to use wp_get_current_user() in query filter
- WP 4.5 hide core customizer sections
- Echo string in admin panel footer beside version no
- How to change default text for specific post type
- Add PHP code after title in single post pages?
- Custom nav walker: How to acces the $args parameter?
- How to stop the deduction in “wp_term_taxonomy” count, when the post is deleted?
- How To Get Search Term and Use in Function
- alternative to the_content filter
- Same URL for portfolio and for a page creates 404 error. Is there any filter that i can use for a child page?
- Filter widget_posts_args not working
- How to pass a variable between filter/action functions?
- Filter the title to only affect the_title() template function
- How can I filter the comment action links so that I can display the actions links based on user capabilities?
- how to unescape wordpress output
- How can I limit access to uploaded media depending on the logged in user’s user role?
- Database & Post Search
- login_url filter creates permanent wp-admin -> wp-login redirection loop
- How can I filter same content in page
- How can I change the button text of a custom widget?
- WordPress Tag Cloud Filter Prevents Widget HTML from loading
- the_content filter not working when Jetpack activated. Any idea?
- Adding Filter | Page Title | Template | Why the_title affecting on menu?
- gettext filter does nothing
- Code restricted to dashboard, running unexpectedly in the frontend (pre_get_post and admin-ajax.php)
- Hide a specific post from Archive Feed
- Restrict access to custom post type and filter from every query
- Why none of xmlrpc filters work
- How to use the filter ‘widget_text’ to a particular text widget with id
- Post Type Upload Directory – {post_type}_upload_dir filter
- Custom xmlrpc request does not pass parameters?
- Hook into ‘when user logs in’ [persistent login]
- Filter on widget-title does not work with custom links
- Problem with shortcodes in external file
- WordPress URL rewrite problem
- How to reset/remove added filters ‘posts_join’ and ‘posts_orderby’ after the loop is completed?
- How to turn this customized core function into a filter/action in functions.php?
- Which hook should be used in this case?
- Categorize posts on a page o the basis of category of other post on the same page
- manage_users_custom_columns filter not firing callback functions
- Conditionally including JS based on whether ACF field is set [closed]
- How to elect position of new item output in a dropdown when using add_filter
- Query Multiple Filters, one with Meta
- How to remove a filter that is an object method?
- Filter a custom post type by custom field in admin
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields
- How to change content hash value, within the_block_template_skip_link action?
- “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter