[Support request] RSS Feed – Feed for Post type “page”

Home Forums Support [Support request] RSS Feed – Feed for Post type “page”

Home Forums Support RSS Feed – Feed for Post type “page”

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2312363
    Stephan Schramm

    Dear all,

    my homepage has only pages so far. However, I would like to create a RSS feed. I understand that with wordpress this is not possible. Therefore I have inserted the following code through a snippet:

    /**
    ********************
    * CHANGES TS
    ********************
    *
    * Add RSS Feed for Pages
    */
    add_action( ‘pre_get_posts’, ‘t5_pages_in_feed’ );

    /**
    * Set post type to ‘page’ if it was requested.
    *
    * @param object $query
    * @return void
    */
    function t5_pages_in_feed( &$query )
    {
    if ( isset ( $_GET[‘post_type’] ) && $_GET[‘post_type’] === ‘page’ && is_feed() )
    {
    $query->set( ‘post_type’, ‘page’ );
    $post_ids = array(8, 3, 2086);
    $query->set(‘post__not_in’, $post_ids);
    }
    }

    Unfortunately, it still does not work. I have tried to reach the RSS via the following address:

    https://asiaversum.de/feed/?post_type=page

    Can you support me?

    Many thanks in advance

    STephan

    #2312498
    Leo
    Staff
    Customer Support

    Hi Stephan,

    Unfortunately this is not a theme/GP-related question at all so it’s out of the scope of this support forum:
    https://generatepress.com/what-support-includes/

    I would recommend checking with WordPress’ support team as the pre_get_posts is a WP core filter.

    Or post your question in a general WordPress forum like this:
    https://wordpress.stackexchange.com/

    Hope this helps 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.