API Guide > Command plug-ins >

# Attaching a plug-in to a Maya menu

It is often necessary to make the functionality of a plug-in command available through the Maya menus. This can be accomplished using the MFnPlugin class. The two methods of interest are:

    MStringArray addMenuItem( const MString& menuItemName, const MString& parentName, const MString& commandName, const MString& commandParams, bool needOptionBox = false, MString *optBoxFunction = NULL, MStatu *retStatus = NULL );
    MStatus removeMenuItem(MStringArray& menuItemNames);

The addMenuItem() method can be called in the initializePlugin() method while removeMenuItem() would be invoked from uninitializePlugin().