How to write category to default_content (1 post)

  1. modcity
    Posted 3 years ago #

    I want to add my product category to the default content upon posting a new product so that the actual category is searchable via content.

    This is what I put in my functions.php file, but it does not work:

    add_filter( 'default_content', 'cat_meta' );
    function cat_meta() {
    global $post;

    //don't filter outside of the loop
    if ( !in_the_loop() )
    return $content;

    $content .= mp_tag_list($post->ID);

    return $content;

    Is there another way to do this? It seems to work fine if you post actual text to the default editor, but not a function. Can someone please help with a proper function that will output the category to text and then post it to the description?

    Much appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic