• I’m technically ripped off people’s projects, learning from them, and try to learn something new. Everything went fine up to the moment.

    <?php
    
    // Plugin Name: Experiment
    
        $linkdata = array(
    	'link_name' => 'I"M HERE!!',
    	'link_url' => 'http://codex.wordpress.org'
        );
    
        $_tmp = wp_insert_link( $linkdata, true);
    
    ?>

    I can’t seem to find any link called I”M HERE!! anywhere. What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Earlier versions of WordPress had a blogroll, which was simply a list of links displayed next to the blog. This was disabled from V3.5, but a plugin was created to turn the functionality back on if needed (see https://codex.wordpress.org/Links_Manager). The blogroll showed on the dashboard as a ‘Links’ option, to enable you to add new links to the blogroll. The function above simply adds a link to the blogroll or modifies it, but of course that doesn’t really do anything useful, as all that is now disabled by default.
    I’m guessing you didn’t actually want to add a link to the blogroll…

    Thread Starter MaybeJustMaybe

    (@maybejustmaybe)

    Instead of having a plugin, I’d like to learn how to add this myself. I want to PROGRAM it but not use it as plugin.

    I wrote this part after reading, here comes to next part after I tried enabling it (it is included in the link you provided):

    So my code is not changed a lot, it’s this:

    <?php
    
    // Plugin Name: Experiment
    
    	add_filter( 'pre_option_link_manager_enabled', '__return_true' );
    
        $linkdata = array(
    	'link_name' => 'I"M HERE!!',
    	'link_url' => 'http://codex.wordpress.org'
        );
    
        wp_insert_link( $linkdata, true);
    
    ?>

    I went to 127.0.0.1/prj/wp-admin/options.php. And changed link_manager_enabled. From 0 to 1. And there’s still no link.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘I can't understand wp_insert_link();’ is closed to new replies.