• I have a shortcode displaying the documents on the front end.

    [documents post_status=”private” post_status=”public” numberposts=”1000″ year=”2019″ orderby=”meta_value_num” workflow_state=”WorkflowName”]

    Do you have any idea why the name would be display on the front end as starting with “Private: FileName”?

    Private: FileName [Edit]
    Private: FileName [Edit]
    Private: FileName [Edit]
    Private: FileName [Edit]
    Private: FileName [Edit]

    Is it possible to just have it display as “FileName”?

    Thanks!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ABarBot

    (@abarbot)

    I figured it out already – in case someone is interested.

    Add this to your functions.php

    // remove “Private: ” from titles
    function remove_private_prefix($title) {
    $title = str_replace(‘Private: ‘, ”, $title);
    return $title;
    }
    add_filter(‘the_title’, ‘remove_private_prefix’);

    Plugin Contributor nwjames

    (@nwjames)

    FWIW, what you are seeing on the screen is the output of the standard WP function get_the_title.

    This can add either

    Private:

    and/or

    Protected:

    (or their translations) as you have found.

    By making the filter private_title_format return ‘%s’ will then not add the Private tag to be removed afterwards for your purpose.

    Regards,
    Neil

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode and File Name Displayed’ is closed to new replies.