# Wordpress plugin to add link only

**URL:** <https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041>\
**Category:** WordPress\
**Created:** [Décembre 9, 2016, 9:45 UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041 "2016-12-09T21:45:33Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [Décembre 29, 2016, 11:09 UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/8 "2016-12-29T23:09:35Z")

</div>

Assuming you’re not using SSO, you could try adding something to your theme’s `functions.php` file that hooks into the WordPress `the_content` filter.

This works quite well with a theme based off the ‘Twenty Sixteen’ theme. You can change the link text in the function, and customize or remove the `$discourse_link_instructions` text.

```php

// Your theme's functions.php file.

function your_site_prefix_discourse_link( $content ) {
    global $post;

    if ( is_single() && get_post_meta( $post->ID, 'publish_to_discourse', true ) ) {
        $discourse_permalink = get_post_meta( $post->ID, 'discourse_permalink', true );
        $discourse_link_instructions = '<p>Leave a comment here, or join the discussion on our forum.</p>';

        return $content . '<div class="discourse-topic-link">' . $discourse_link_instructions . '<a href="' . esc_url( $discourse_permalink ) . '">Comment on our forum</a></div>';
    }

    return $content;
}

add_filter( 'the_content', 'your_site_prefix_discourse_link' );

```

```css

/* style.css */

.discourse-topic-link {
    padding-top: 1.75em;
    border-top: 1px solid #d1d1d1;
    font-family: "Helvetica Neue", sans-serif;
}

.discourse-topic-link a {
    display: inline-block;
    color: #ffffff;
    background-color: #007acc;
    padding: 0.84375em 0.875em 0.78125em;;
    border: 0;
    border-radius: 2px;
    font-family: "Helvetica Neue", sans-serif;
    font-weight: 700;
    letter-spacing: 0.046875em;
    line-height: 1;
    padding: 0.84375em 0.875em 0.78125em;
    text-transform: uppercase;
}

.discourse-topic-link a:hover {
    background: #0091e3;
}

```

 ![](https://global.discourse-cdn.com/meta/original/3X/a/4/a40d366a77cb6a5750023b4e665d8e90999643ae.png)

---

_[View the full topic](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041)._
