• Is it possible to retrieve ALL links generated in a wordpress site?
    I am talkin about pages, dynamic links generated on a user request, custom post type and so on
    I tried a couple of plugin to get the map of a site but I only get a list of my static page. Instead, mappers online can go trough all my links and show me all the links.

    Is there a way to have a list of them? may using php o wordpress codex?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @mobius01001,

    The method I’m going to provide may not work on your end or other WP setup, so I would highly suggest you backup your site first. One way to achieve this is by querying the WordPress database directly using custom PHP code. Below is a basic example using the WP_Query class to get links from various content types such as pages, posts, and custom post types:

    $args = array(
        'post_type' => array('page', 'post', 'your_custom_post_type'),
        'posts_per_page' => -1, // Retrieve all posts
    );
    
    $query = new WP_Query($args);
    
    while ($query->have_posts()) {
        $query->the_post();
        $permalink = get_permalink();
        echo $permalink . '<br>';
    }
    
    wp_reset_postdata();
    

    Replace 'your_custom_post_type' with the actual name of your custom post type. This code will output all the permalinks for pages, posts, and your custom post type.

    Keep in mind that this method retrieves links based on the content stored in the WordPress database, and it won’t capture dynamically generated links through user requests or JavaScript interactions. If your site relies heavily on dynamic content loaded asynchronously, this won’t be the way for it.

    All the best!

    Thread Starter mobius01001

    (@mobius01001)

    thanks for you reply!
    Anyway I am talking about custom post type that are generated dynamically.
    Anyway if I use a mapper online, it is able to retrieve all link generated; but I didn’t find a plugin able to do the same on my site.

    How come?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List all links of a wordpress site’ is closed to new replies.